3raser Posted March 10, 2011 Share Posted March 10, 2011 How do you generate a random number like say, 0 through 10? I want to select random sites from my database that have IDs 0 through 10. Link to comment https://forums.phpfreaks.com/topic/230169-generate-random-numbers/ Share on other sites More sharing options...
cyberRobot Posted March 10, 2011 Share Posted March 10, 2011 rand() should work: http://php.net/manual/en/function.rand.php Link to comment https://forums.phpfreaks.com/topic/230169-generate-random-numbers/#findComment-1185346 Share on other sites More sharing options...
devWhiz Posted March 10, 2011 Share Posted March 10, 2011 ".rand(1,10)." Link to comment https://forums.phpfreaks.com/topic/230169-generate-random-numbers/#findComment-1185355 Share on other sites More sharing options...
3raser Posted March 10, 2011 Author Share Posted March 10, 2011 Thanks guys, much appreciated for the quick replies. Link to comment https://forums.phpfreaks.com/topic/230169-generate-random-numbers/#findComment-1185358 Share on other sites More sharing options...
oldmatt Posted March 10, 2011 Share Posted March 10, 2011 Or you could use mt_rand(). http://www.php.net/manual/en/function.mt-rand.php Link to comment https://forums.phpfreaks.com/topic/230169-generate-random-numbers/#findComment-1185361 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.