Use a weighted random when determining the stage of a new pawn

This commit is contained in:
lutepickle 2022-07-07 07:26:53 -07:00
parent 983e112edd
commit 93218a8aa1
1 changed files with 5 additions and 2 deletions

View File

@ -1841,7 +1841,10 @@ namespace RJW_Menstruation
protected Stage RandomStage()
{
int rand = Rand.Range(0, 2);
int rand = Rand.ElementByWeight(
0, Props.folicularIntervalDays - Props.bleedingIntervalDays,
1, Props.lutealIntervalDays,
2, Props.bleedingIntervalDays);
switch (rand)
{
@ -1849,7 +1852,7 @@ namespace RJW_Menstruation
curStageHrs = Rand.Range(0, (Props.folicularIntervalDays - Props.bleedingIntervalDays) * 24);
return Stage.Follicular;
case 1:
curStageHrs = Rand.Range(0, Props.eggLifespanDays * 24);
curStageHrs = Rand.Range(0, Props.lutealIntervalDays * 24);
return Stage.Luteal;
case 2:
curStageHrs = Rand.Range(0, Props.bleedingIntervalDays * 24);