The standard way to get a random integer in the range [0, n) in JavaScript - or any other language that only offers a random() function that returns a float in the range [0,
Assuming random() is returning a number between 0..1.
If the result is a single precision float than thats only 23bits of entropy based on the mantissa.
If the result is a double precision float than thats only 52bits of entropy based on the mantissa.
So floor(random() * N) would only be uniform where N is less than 2^24 or 2^53.
EDIT Here's some info on largest consecutive integer for floating point http://www.mathworks.com/help/matlab/ref/flintmax.html