jigen7 Posted September 22, 2007 Share Posted September 22, 2007 can anyone hep me me make a function that return random numbers but it will not generate another random number if he already pass the value for example it return 2, so after i call the function random again it will not return another 2 i want another numbers to be returned instead ?? can anyone help me here? function random($max){ srand ((double) microtime( )*1000000); $random_number = rand(0,$max); return $random_number; } Link to comment https://forums.phpfreaks.com/topic/70242-helpgenerating-random-number-without-the-generated-numbers-already/ Share on other sites More sharing options...
Jessica Posted September 22, 2007 Share Posted September 22, 2007 you could make an array of numbers using range, and then shuffle it and unset it one by one. Link to comment https://forums.phpfreaks.com/topic/70242-helpgenerating-random-number-without-the-generated-numbers-already/#findComment-352799 Share on other sites More sharing options...
jigen7 Posted September 22, 2007 Author Share Posted September 22, 2007 that will do thx jessie?? any other idea? Link to comment https://forums.phpfreaks.com/topic/70242-helpgenerating-random-number-without-the-generated-numbers-already/#findComment-352804 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.