asmith Posted November 30, 2007 Share Posted November 30, 2007 $a = rand(1,100) is that possible i delete the number of $a from range of the rand ? for example $a= rand(1,100) $b = rand (1,100) // here min 1 , max 100 , but not including $a $c = rand(1,100) // here min1 , max 100 , but without $a and $b Quote Link to comment Share on other sites More sharing options...
~n[EO]n~ Posted November 30, 2007 Share Posted November 30, 2007 Actually what do you mean ? int rand ( [int min, int max] ) If called without the optional min, max arguments rand() returns a pseudo-random integer between 0 and RAND_MAX. If you want a random number between 5 and 15 (inclusive), for example, use rand (5, 15). Quote Link to comment Share on other sites More sharing options...
asmith Posted November 30, 2007 Author Share Posted November 30, 2007 sorry i said it wrong . i don't want rand give me repeated numbers : $a = rand(1,100) $b = rand(1,100) while ($b == $a) {$b = rand(1,100)} that ! i was wondering maybe a specific function it has ? and i don't need to code for that like above . it has ? (then again , it delete the $a from the range of the rand , if $a was 13, then it get rand (1,100) , but without 13 included in that range, that i don't have to check for being repeated) 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.