refactor: rename RNG method from nextFloat to nextFloat1 for consistency across the codebase

This commit is contained in:
2026-01-24 13:58:12 +00:00
parent 8735d350fa
commit f199427ff1
17 changed files with 46 additions and 67 deletions
+9 -5
View File
@@ -13,13 +13,17 @@ export class RandUtil {
return this.nextFloat1() * range + min;
}
public nextRangeInt(min: number, max: number): number {
const range = max - min;
return this.rng.nextInt(range) + min;
public nextRangeInt(minInclusive: number, maxInclusive: number): number {
const range = maxInclusive - minInclusive;
return this.rng.nextInt(range) + minInclusive;
}
public nextInt(max?: number): number {
return this.rng.nextInt(max);
public nextInt(minInclusive: number, maxExclusive: number): number {
const span = maxExclusive - minInclusive;
if (span <= 1) {
return minInclusive;
}
return minInclusive + this.rng.nextInt(span - 1);
}
public nextBit(): boolean {