Temp fix to ensure dynamic loot count generator doesnt generate a negative value
This commit is contained in:
parent
15be241dbf
commit
03a451115c
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user