geneare number between a range
sonill opened this issue · comments
How can i use "seedrandom" to generate a random number between a specific range.
For example: generate number between "0" - "20". I do not want float numbers.
Thank you for any help.
Just multiply by 20 and round yourself:
var rng = new Math.seedrandom(1);
console.log(Math.floor(rng() * 20))
Seedrandom does not include convenience methods for generating other types of random varibles. However, if you prefer to start with a 32-bit signed integer, you can always use rng.int32()
and start from there.