Page 1 of 1

Random with Range

Posted: 13 May 2015 01:19
by jeremyz
Hello

Is there something like this: randRange(0,6) which would return values between 0 to 6?

I know I can do 'rand()*6' but curious if that function exists.

Thanks!
JZ

Re: Random with Range

Posted: 13 May 2015 09:52
by Softcore
No there is no such built in function...

And in case you want integers between 0 and 6 then you ll go:

decl val=round(rand()*6);

Re: Random with Range

Posted: 15 May 2015 02:23
by jeremyz
Thanks for the response Softcore.

-j