Beispiel #1
0
        // Give random unit vector
        public static Vector2 RandomUnitVector()
        {
            Vector2 randomVector = new Vector2(SRandom.Double(1.0) - 0.5, SRandom.Double(1.0) - 0.5);

            if (randomVector.IsZero())
            {
                randomVector.x = 1.0;
            }
            return(randomVector.Normalize());
        }
Beispiel #2
0
        // Give random unit vector
        public static Vector3 RandomUnitVector()
        {
            Vector3 randomVector = new Vector3(SRandom.Double(1.0) - 1.0, SRandom.Double(1.0) - 1.0, SRandom.Double(1.0) - 1.0);

            if (randomVector.IsZero())
            {
                randomVector.x = 1.0;
            }
            return(randomVector.GetNormalized());
        }
Beispiel #3
0
 public static Color32 Random()
 {
     return(new Color32(SRandom.Double(1), SRandom.Double(1), SRandom.Double(1), 1));
 }
Beispiel #4
0
 // Give vector with random x, y components that are between 0..inMaxX, 0..inMaxY
 public static Vector2 Random(double inMaxX, double inMaxY)
 {
     return(new Vector2(SRandom.Double(inMaxX), SRandom.Double(inMaxY)));
 }
Beispiel #5
0
 public static Vector3 Random(double inMaxX, double inMaxY, double inMaxZ)
 {
     return(new Vector3(SRandom.Double(inMaxX), SRandom.Double(inMaxY), SRandom.Double(inMaxZ)));
 }