summaryrefslogtreecommitdiff
path: root/DSACore/Auxiliary/RandomMisc.cs
diff options
context:
space:
mode:
authorDennis Kobert <d-kobert@web.de>2019-06-11 23:38:13 +0200
committerDennis Kobert <d-kobert@web.de>2019-06-11 23:38:13 +0200
commit2fa4a0e50ebfc97059c8b84dbd17e79f9afc8a8d (patch)
treec3b34ccb2737e347a73768536895cbbaab13cc01 /DSACore/Auxiliary/RandomMisc.cs
parentec991104f56e90d7bb2878da2fe6ed4e585dfc46 (diff)
parentaf74efccf8d21e6151022b71f3cacd3fa83024ee (diff)
Merge branch 'rework-backend'
Diffstat (limited to 'DSACore/Auxiliary/RandomMisc.cs')
-rw-r--r--DSACore/Auxiliary/RandomMisc.cs52
1 files changed, 0 insertions, 52 deletions
diff --git a/DSACore/Auxiliary/RandomMisc.cs b/DSACore/Auxiliary/RandomMisc.cs
deleted file mode 100644
index 1295f02..0000000
--- a/DSACore/Auxiliary/RandomMisc.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using System;
-using System.Linq;
-using System.Text;
-
-namespace DSACore.Auxiliary
-{
- public static class RandomMisc
- {
- private static readonly Random Rand = new Random();
-
- // use: 4w6 +4
- public static string Roll(string input)
- {
- var output = new StringBuilder();
- var strings = input.Split('w', 'd').ToList();
- int count = Convert.ToInt32(strings[0]);
- strings = strings[1].Split(' ').ToList();
- int d = Convert.ToInt32(strings[0]);
-
- if (strings.Count > 0)
- {
- }
-
- int sum = 0;
- for (int i = 0; i < count; i++)
- {
- var roll = Dice.Roll(d);
- sum += roll;
- output.Append("[" + roll + "] ");
- }
-
- if (strings.Count > 1)
- {
- sum += Convert.ToInt32(strings[1]);
- output.Append("sum: " + sum);
- }
-
- return output.ToString();
- }
-
- public static double Random(double stdDev = 1, double mean = 0)
- {
- double u1 = Rand.NextDouble(); // uniform(0,1) random doubles
- double u2 = Rand.NextDouble();
- double randStdNormal = Math.Sqrt(-2.0 * Math.Log(u1)) *
- Math.Sin(2.0 * Math.PI * u2); // random normal(0,1)
- double randNormal =
- mean + stdDev * randStdNormal; // random normal(mean,stdDev^2)
- return randNormal;
- }
- }
-}