added dice game. added random double generator.

This commit is contained in:
CrackmaticSoftware
2025-12-07 19:51:17 +01:00
parent ccf26d24a2
commit bdeb2acdf8
2 changed files with 136 additions and 0 deletions

View File

@@ -439,6 +439,28 @@ public static class Money
return result;
}
/// <summary>
/// Get random number double [0, 1]
/// </summary>
/// <param name="gambler">Gambler entity to reference their random seed</param>
/// <param name="iterations">Number of random number generator iterations to run before returning a result</param>
/// <returns>A random number based on the given parameters</returns>
/// <exception cref="ArgumentException"></exception>
public static double GetRandomDouble(GamblerDbModel gambler, int iterations = 10)
{
var rng = StandardRng.Create();
var random = RandomShim.Create(rng);
var result = 0.0;
var i = 0;
if (iterations <= 0) throw new ArgumentException("Iterations cannot be 0 or lower");
while (i < iterations)
{
i++;
result = random.NextDouble();
}
return result;
}
/// <summary>
/// Get the user's current VIP level
/// </summary>