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 );
精彩评论