Exemple #1
0
        public Vector3 Next(IRandomGenerator generator)
        {
            float radius = _distrib.Next(generator);

            radius = Mathf.Pow(radius, 1 / 3.0f) * _radius;
            float yaw   = _dAngle.Next(generator);
            float pitch = Mathf.Acos(_distrib.Next(generator) * 2 - 1);

            return(new Vector3(Mathf.Cos(yaw) * Mathf.Sin(pitch) * radius, Mathf.Sin(yaw) * Mathf.Sin(pitch) * radius, Mathf.Cos(pitch) * radius));
        }
        public Vector3 Next(IRandomGenerator generator)
        {
            float dX = _d.Next(generator);
            float dY = _d.Next(generator);

            if (dX + dY > 1.0f)
            {
                dX = 1 - dX;
                dY = 1 - dY;
            }

            return(_v1 * (1 - dX - dY) + _v2 * dX + _v3 * dY);
        }
        public Vector2 Next(IRandomGenerator generator)
        {
            float radius = _dRadius.Next(generator);

            radius = Mathf.Sqrt(radius) * _radius;
            //radius *= radius * _radius;
            float angle = _dAngle.Next(generator);

            return(new Vector3(radius * Mathf.Cos(angle), radius * Mathf.Sin(angle)));
        }
        public int Next(IRandomGenerator generator)
        {
            float currentWeight = _distrib.Next(generator);

            for (int i = 0; i < _weights.Count; i++)
            {
                currentWeight -= _weights[i];
                if (currentWeight <= 0)
                {
                    return(i);
                }
            }
            return(-1);
        }
Exemple #5
0
 public Vector2 Next(IRandomGenerator generator)
 {
     return(new Vector2(_dX.Next(generator), _dY.Next(generator)));
 }
Exemple #6
0
        public Vector2 Next(IRandomGenerator generator)
        {
            float angle = _dAngle.Next(generator);

            return(new Vector2(_radius * Mathf.Cos(angle), _radius * Mathf.Sin(angle)));
        }