Desdinova Posted April 6, 2006 Share Posted April 6, 2006 This doesn't seem possible with rand();what I need is, I have say 32 options. I want to select a number between 1 and 32. How should I do this? Quote Link to comment Share on other sites More sharing options...
obsidian Posted April 6, 2006 Share Posted April 6, 2006 [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]If you want a random number between 5 and 15 (inclusive), for example, use rand (5, 15).[/quote]with that in mind, for your solution, you simply need to do the following:[code]$i = rand(1, 32);[/code] Quote Link to comment Share on other sites More sharing options...
Desdinova Posted April 6, 2006 Author Share Posted April 6, 2006 yeah you're right.php.net explanes it badly. I thought rand(1,30) would create a 30char long random string.thanks:) Quote Link to comment Share on other sites More sharing options...
obsidian Posted April 6, 2006 Share Posted April 6, 2006 [!--quoteo(post=362241:date=Apr 6 2006, 10:55 AM:name=Desdinova)--][div class=\'quotetop\']QUOTE(Desdinova @ Apr 6 2006, 10:55 AM) [snapback]362241[/snapback][/div][div class=\'quotemain\'][!--quotec--]yeah you're right.php.net explanes it badly. I thought rand(1,30) would create a 30char long random string.thanks:)[/quote]the manual definitely can be difficult to understand at times... that's why we're here ;-) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.