Cleanup Utility.cs

This commit is contained in:
amevarashi 2022-06-12 09:32:17 +05:00
parent 7e3034a300
commit 1e24da5312

View file

@ -1,11 +1,11 @@
using System; using RimWorld;
using RimWorld; using System;
namespace RJWSexperience namespace RJWSexperience
{ {
public static class Utility public static class Utility
{ {
public static System.Random random = new System.Random(Environment.TickCount); private static readonly Random random = new Random(Environment.TickCount);
public static float RandGaussianLike(float min, float max, int iterations = 3) public static float RandGaussianLike(float min, float max, int iterations = 3)
{ {
@ -14,9 +14,9 @@ namespace RJWSexperience
{ {
res += random.NextDouble(); res += random.NextDouble();
} }
res = res / iterations; res /= iterations;
return (float)res * (max - min) + min; return ((float)res).Denormalization(min, max);
} }
public static void SetTo(this Pawn_RecordsTracker records, RecordDef record, float value) public static void SetTo(this Pawn_RecordsTracker records, RecordDef record, float value)
@ -32,7 +32,7 @@ namespace RJWSexperience
public static float Denormalization(this float num, float min, float max) public static float Denormalization(this float num, float min, float max)
{ {
return num * (max - min) + min; return (num * (max - min)) + min;
} }
} }
} }