I have this:
$numbers = range(1,52);
shuffle($numbers);
foreach($users as $user) {
$uniqueRand = array_pop($numbers);
}
This give each user in my database a unique random number.
I have 15 users in total, is it somehow possible to fill the rest of the range from 1-32 and repeat the randoming so to say.
it looks like this now:
1 - 24
2 - 26
3 - 2
4 - 6
5 - 8
6 - 31
7 - 25
8 - 16
9 - 13
10 - 21
11 - 19
12 - 29
13 - 8
14 - 4
15 - 6
Just users with random numbers, is it possible the give those numbers which were not allocated to a user in the range again randomly a user until all numbers in the range are given?
Will output something like:
Edit: Forgot something. You might want to shuffle() the numbers, too, to get a more random distribution. Added the line to the function.