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 Link to comment https://forums.phpfreaks.com/topic/79567-rand/ 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). Link to comment https://forums.phpfreaks.com/topic/79567-rand/#findComment-402989 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) Link to comment https://forums.phpfreaks.com/topic/79567-rand/#findComment-402990 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.