add Fix64 random range

main
cosmonaut 2022-06-14 18:25:37 -07:00
parent c1085db9c5
commit ba662d7c3e
1 changed files with 5 additions and 0 deletions

View File

@ -69,6 +69,11 @@ namespace MoonWorks.Math.Fixed
return new Fix64(rawValue); return new Fix64(rawValue);
} }
public static Fix64 Random(System.Random random, Fix64 min, Fix64 max)
{
return new Fix64(random.NextInt64(min.RawValue, max.RawValue));
}
// Max should be between 0.0 and 1.0. // Max should be between 0.0 and 1.0.
public static Fix64 RandomFraction(System.Random random, Fix64 max) public static Fix64 RandomFraction(System.Random random, Fix64 max)
{ {