quote:
Originally posted by CookieRevised
quote:
Originally posted by Jesus
both will do the job, but... I didn't expect you to be this sloppy cookie, in your average posts you wouldn't use -1+1... getting sleepy??
Jesus, read what -!Felu!- has written, then read my post again, properly... There is absolutely nothing sloppy about my post.
I don't see any post by -!Felu!- in this thread...
maybe he deleted it?
quote:
quote:
Originally posted by Jesus
I'd use Math.floor(Math.random() * 101); tbh(Smilie)
Then you're wrong. It will generate random numbers from 0 to 100.
quote:
Originally posted by foaly
Then you still can get 0...
true, I noticed that and corrected it as you were typing
quote:
[b]it should be
Math.floor((upperbound - lowerbound + 1) * Math.random() + lowerbound);
thus
Math.floor((100 - 1 + 1) * Math.random() + 1);
thus
Math.floor(Math.random() * 100 + 1);
Sorry, I never saw you or anyone else post the
Math.floor((upperbound - lowerbound + 1) * Math.random() + lowerbound); part. that would have made it a lot clearer
at least we agree on the Math.floor(Math.random() * 100 +1); part