mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-02-19 14:29:20 +00:00
Remove nextIntRangeInclusive
This function gave the minimum and maximum integer half as much weight, and it was not used anywhere except to generate a freeplay shape color palette, and that now uses nextIntRange.
This commit is contained in:
parent
23c52c4379
commit
136867d82d
@ -108,17 +108,6 @@ export class RandomNumberGenerator {
|
|||||||
assert(max > min, "rng: max <= min");
|
assert(max > min, "rng: max <= min");
|
||||||
return Math.floor(this.next() * (max - min) + min);
|
return Math.floor(this.next() * (max - min) + min);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @param {number} min
|
|
||||||
* @param {number} max
|
|
||||||
* @returns {number} Integer in range [min, max]
|
|
||||||
*/
|
|
||||||
nextIntRangeInclusive(min, max) {
|
|
||||||
assert(Number.isFinite(min), "Minimum is no integer");
|
|
||||||
assert(Number.isFinite(max), "Maximum is no integer");
|
|
||||||
assert(max > min, "rng: max <= min");
|
|
||||||
return Math.round(this.next() * (max - min) + min);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} min
|
* @param {number} min
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user