gausroth
9 months agoMentor
Random Range Int and Float
For those that are used to Unity might recognize this.
// returns a random whole number between min (inclusive) and max (exclusive)
randomRange(min: number, max: number) {
return Math.floor(min + Math.random() * (max - min));
}
// returns a float between min (inclusive) and max (exclusive)
randomRange(min: number, max: number) {
return min + Math.random() * (max - min);
}