using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class HelpingFunctions {
    public static float nextGaussian(float mean, float sd) {
        float x = Random.value;
        float y = Random.value;
        //Debug.Log("point is "+x + " " + y);
        float rndNormal = Mathf.Sqrt(-2.0f * Mathf.Log(x)) * Mathf.Sin(2.0f * Mathf.PI * y);
        //Debug.Log("equivalent Normal is " + rndNormal);
        float rndGaussian = mean + rndNormal * sd;
        //Debug.Log("resulting Gaussian is " + rndGaussian);
        return rndGaussian;
    }

    public static float nextGaussianMeanZero(float sd) {
        return nextGaussian(0, sd);
    }
    public static float nextNormal()
    {
        return nextGaussian(0, 1);
    }
}
