docs.unity.cn
    Show / Hide Table of Contents

    Method NextFloat

    NextFloat()

    Returns a uniformly random float value in the interval [0, 1).

    Declaration
    public float NextFloat()
    Returns
    Type Description
    Single

    A uniformly random float value in the range [0, 1).

    NextFloat(Single)

    Returns a uniformly random float value in the interval [0, max).

    Declaration
    public float NextFloat(float max)
    Parameters
    Type Name Description
    Single max

    The maximum value to generate, exclusive.

    Returns
    Type Description
    Single

    A uniformly random float value in the range [0, max).

    NextFloat(Single, Single)

    Returns a uniformly random float value in the interval [min, max).

    Declaration
    public float NextFloat(float min, float max)
    Parameters
    Type Name Description
    Single min

    The minimum value to generate, inclusive.

    Single max

    The maximum value to generate, exclusive.

    Returns
    Type Description
    Single

    A uniformly random float value in the range [min, max).

    Back to top Copyright © 2022 Unity Technologies
    Generated by DocFX
    on Tuesday, March 29, 2022
    Terms of use