The Rand class is used to create random numbers using a 32-bit unsigned integer seed.

Rand 类用于通过32位无符号整型随机种子创建随机数。

构造函数

属性

seeds: Uint32Array = ...

Obtain random seeds

获取随机种子。

访问器

方法

  • 返回 number

    The floating-point random number between 0 and 1.

    Gets a floating-point random number between 0 and 1.

    获取0到1之间的浮点随机数。

  • 返回 number

    The floating-point random number between -1 and 1.

    Gets a floating-point random number between -1 and 1.

    获取-1到1之间的浮点随机数。

  • 返回 number

    The unsigned 32-bit integer random number.

    Gets an unsigned 32-bit integer random number.

    获取无符号32位整数随机数

  • 参数

    • v: number

      The unsigned 32-bit integer random number.

    返回 number

    The unsigned 8-bit byte random number.

    Obtain an unsigned 8-bit byte random number through unsigned 32-bit shaping.

    通过无符号32位整形,获取无符号8位字节随机数。

  • 参数

    • v: number

      The unsigned 32-bit integer random number.

    返回 number

    The 32-bit floating-point random number.

    Obtain unsigned 32-bit floating-point random numbers through unsigned 32-bit shaping

    通过无符号32位整形,获取32位浮点随机数。