Show / Hide Table of Contents

    Class RandomExtensions

    Extension methods for generating new random objects from an instance of System.Random.

    Inheritance
    System.Object
    RandomExtensions
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Elements
    Assembly: Hypar.Elements.dll
    Syntax
    public static class RandomExtensions

    Methods

    NextColor(Random)

    Generate a new color with a random R, G, and B component. Useful for debugging purposes.

    Declaration
    public static Color NextColor(this Random random)
    Parameters
    Type Name Description
    System.Random random

    The Random object.

    Returns
    Type Description
    Color

    NextMaterial(Random, Boolean)

    Generate a new material with a random color assigned. Useful for debugging purposes.

    Declaration
    public static Material NextMaterial(this Random random, bool unlit = true)
    Parameters
    Type Name Description
    System.Random random

    The Random object.

    System.Boolean unlit

    Whether or not to treat the material as unlit.

    Returns
    Type Description
    Material

    NextRay(Random, Vector3)

    Generate a ray in a random direction.

    Declaration
    public static Ray NextRay(this Random random, Vector3 origin)
    Parameters
    Type Name Description
    System.Random random

    The Random object.

    Vector3 origin

    The origin of the ray.

    Returns
    Type Description
    Ray

    NextRayInPlane(Random, Vector3, Vector3)

    Generate a ray in a random direction in the specified plane.

    Declaration
    public static Ray NextRayInPlane(this Random random, Vector3 origin, Vector3 normal)
    Parameters
    Type Name Description
    System.Random random

    The Random object.

    Vector3 origin

    The origin of the ray.

    Vector3 normal

    The normal of the plane in which the resulting ray will lie.

    Returns
    Type Description
    Ray

    A ray pointing in a random direction, along the plane.

    NextVector(Random, BBox3)

    Generate a new random vector with an optional bounds.

    Declaration
    public static Vector3 NextVector(this Random random, BBox3 bounds = default(BBox3))
    Parameters
    Type Name Description
    System.Random random

    The Random object to generate from

    BBox3 bounds

    If specified, the bounds within which the vectors will be generated. If not specified, vectors will be generated in the range (-1,-1,-1) to (1,1,1).

    Returns
    Type Description
    Vector3