diff --git a/CatSAT/SAT/Random.cs b/CatSAT/SAT/Random.cs
index dba18aa..f9a3a24 100644
--- a/CatSAT/SAT/Random.cs
+++ b/CatSAT/SAT/Random.cs
@@ -35,6 +35,23 @@ internal static class Random
{
#if XORSHIFT
private static uint state = 234923840;
+
+ ///
+ /// Set the seed to a specified value.
+ ///
+ public static void SetSeed(uint seed)
+ {
+ state = seed;
+ }
+
+ ///
+ /// Set the seed to the current time (System.DateTime.Now.Ticks)
+ ///
+ public static void SetSeed()
+ {
+ SetSeed((uint)System.DateTime.Now.Ticks);
+ }
+
public static uint Next()
{
/* Algorithm "xor" from p. 4 of Marsaglia, "Xorshift RNGs" */
@@ -59,10 +76,10 @@ public static uint Next()
}
#endif
- ///
- /// Return a random integer in [0, max)
- ///
- public static uint InRange(uint max)
+ ///
+ /// Return a random integer in [0, max)
+ ///
+ public static uint InRange(uint max)
{
return Next() % max;
}
@@ -89,7 +106,7 @@ public static uint InRange(uint min, uint max)
///
public static T RandomElement(this List list)
{
- return list[(int)InRange((uint)list.Count)];
+ return list[(int) InRange((uint) list.Count)];
}
///
@@ -374,7 +391,7 @@ public static uint Prime()
public static float Float(float min, float max)
{
double unitInterval = Next() / ((double) uint.MaxValue);
- return min + (max - min) * (float)unitInterval;
+ return min + (max - min) * (float) unitInterval;
}
}
}