dimanche 21 octobre 2018

Unity: Get a random value from a probability distribution

I would like to get a random value from a von Mises distribution using the Accord.NET framework for statistics. It should return a float between -pi and pi, where it's most likely to return values close to the mean. The end goal is to have a player perform a random walk, where it's more likely to walk in a certain direction. Currently I am only able to generate a distribution.

public class RandomWalk : MonoBehaviour {
    void Start()
    {
        // Creates von Mises distribution with default mean 0 and concentration 1            
        var vonmises = new VonMisesDistribution();
    }

}

The von Mises is not necessary, I am looking for a way to retrieve a random value from any probability density (e.g. normal distribution).




Aucun commentaire:

Enregistrer un commentaire