Пример #1
0
        public static Vector2 Disk(ref UMT.MersenneTwister _rand, MTRandom.Normalization n, float temp)
        {
            double t, theta;

            switch (n)
            {
            case MTRandom.Normalization.STDNORMAL:
                t     = NormalDistribution.Normalize(_rand.NextSingle(true), temp);
                theta = NormalDistribution.Normalize(_rand.NextSingle(true), temp) * 2 * Math.PI;
                break;

            case MTRandom.Normalization.POWERLAW:
                t     = PowerLaw.Normalize(_rand.NextSingle(true), temp, 0, 1);
                theta = PowerLaw.Normalize(_rand.NextSingle(true), temp, 0, 1) * 2 * Math.PI;
                break;

            default:
                t     = (float)_rand.NextSingle(true);
                theta = _rand.NextSingle(false) * 2 * Math.PI;
                break;
            }

            return(new Vector2((float)(Math.Sqrt(t) * Math.Cos(theta)), (float)(Math.Sqrt(t) * Math.Sin(theta))));
        }