How effective is this fomula in getting
1(inclusive) to 100(inclusive) value at random?
Math.floor((Math.random()+0.01) * 100);
Any suggestion for better one?
Say, my math.random() gets 0.9999
I +0.01 it, and it gives 1.0999
then times 100, i get 100.99, after I math.floor it, it is 100 right? not 110.
1(inclusive) to 100(inclusive) value at random?
Math.floor((Math.random()+0.01) * 100);
Any suggestion for better one?
Say, my math.random() gets 0.9999
I +0.01 it, and it gives 1.0999
then times 100, i get 100.99, after I math.floor it, it is 100 right? not 110.
Last edited: