Initial Commit

This commit is contained in:
Simeon Radivoev 2022-02-12 12:53:50 +02:00
commit ee5c2f922d
Signed by: simeonradivoev
GPG key ID: 7611A451D2A5D37A
2255 changed files with 547750 additions and 0 deletions

View file

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
namespace DefaultNamespace
{
public static class RandomExtensions
{
public static double NextGaussian(this Random r, double mu = 0, double sigma = 1)
{
var u1 = r.NextDouble();
var u2 = r.NextDouble();
var rand_std_normal = Math.Sqrt(-2.0 * Math.Log(u1)) * Math.Sin(2.0 * Math.PI * u2);
var rand_normal = mu + sigma * rand_std_normal;
return rand_normal;
}
public static void Shuffle<T>(this IList<T> list)
{
var n = list.Count;
while (n > 1)
{
n--;
var k = UnityEngine.Random.Range(0, n + 1);
(list[k], list[n]) = (list[n], list[k]);
}
}
}
}