开发者

How to genenerate 24 random numbers between 1 and 24 in PHP?

For this Wordpress site, I need to generate 24 variables each of which contains a number be开发者_运维百科tween 1 and 24. The problem is that two variables cannot have the same value. So I basically need to generate 24 variables each of which contains a number between 1 and 24.

Here's the code that I am using to generate a random number.

$mirza = rand(1,24);

Thanks for any help.


You can use shuffle

$numbers = range(1, 24);
shuffle($numbers);


$a = range(1,24);
shuffle ( $a );
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜