diff --git a/project/src/generators/LocationGenerator.ts b/project/src/generators/LocationGenerator.ts index ebb623e7..52cb8413 100644 --- a/project/src/generators/LocationGenerator.ts +++ b/project/src/generators/LocationGenerator.ts @@ -603,7 +603,7 @@ export class LocationGenerator // Draw from random distribution const desiredSpawnpointCount = Math.round( this.getLooseLootMultiplerForLocation(locationName) - * this.randomUtil.randn(dynamicLootDist.spawnpointCount.mean, dynamicLootDist.spawnpointCount.std), + * Math.abs(this.randomUtil.randn(dynamicLootDist.spawnpointCount.mean, dynamicLootDist.spawnpointCount.std)), ); // Positions not in forced but have 100% chance to spawn diff --git a/project/src/utils/RandomUtil.ts b/project/src/utils/RandomUtil.ts index f0782da7..b314e2d3 100644 --- a/project/src/utils/RandomUtil.ts +++ b/project/src/utils/RandomUtil.ts @@ -292,8 +292,8 @@ export class RandomUtil { v = Math.random(); } - const w = Math.sqrt(-2.0 * Math.log(u)) * Math.cos(2.0 * Math.PI * v); - return mu + w * sigma; + const w = Math.sqrt(-2.0 * Math.log(u)) * Math.cos((2.0 * Math.PI) * v); + return w * sigma + mu; } /** @@ -309,10 +309,8 @@ export class RandomUtil { return low + Math.floor(Math.random() * (high - low)); } - else - { - return Math.floor(Math.random() * low); - } + + return Math.floor(Math.random() * low); } /**