gibigbig Posted March 26, 2010 Share Posted March 26, 2010 i would like a script to output two numbers between 1 and 4 where both numbers are never the same. i know i have to use the rand() but when it comes to looping until the numbers are not identical, im stumped =/ Link to comment https://forums.phpfreaks.com/topic/196610-php-radomizer-help/ Share on other sites More sharing options...
Kieran Menor Posted March 26, 2010 Share Posted March 26, 2010 $one = mt_rand(1, 4); do { $two = mt_rand(1, 4); } while ($two === $one); Edit: Aaah. My bad. There shouldn't be an exclamation mark there. Link to comment https://forums.phpfreaks.com/topic/196610-php-radomizer-help/#findComment-1032283 Share on other sites More sharing options...
gibigbig Posted March 26, 2010 Author Share Posted March 26, 2010 works fine thanks /solved Link to comment https://forums.phpfreaks.com/topic/196610-php-radomizer-help/#findComment-1032287 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.