Skip to content

Instantly share code, notes, and snippets.

@ciscoslot
ciscoslot / GaussianRandom.cs
Created April 4, 2016 13:24
Unity Gaussian Random
using UnityEngine;
public static class GaussianRandom
{
public static float generateNormalRandom(float mu, float sigma)
{
float rand1 = Random.Range(0.0f, 1.0f);
float rand2 = Random.Range(0.0f, 1.0f);
float n = Mathf.Sqrt(-2.0f * Mathf.Log(rand1)) * Mathf.Cos((2.0f * Mathf.PI) * rand2);