xk6-example
    Preparing search index...

    Class Random

    Pseudo random number generator.

    Index

    Constructors

    Properties

    Methods

    Constructors

    • Create a new Random instance.

      The seed parameter is optional, if missing a random initial seed will be used.

      Parameters

      • Optionalseed: Number

        Initial seed for the generator

      Returns Random

    Properties

    seed: number

    Initial seed for the generator. If it is changed, the generator will restart.

    Methods

    • Generate a non-negative pseudo-random float.

      The generated float will be from the half-open interval [0,n). If the optional parameter n is missing, 1 will be used instead.

      Parameters

      • n: number

        The upper bound, 1 if missing.

      Returns number

    • Generate a non-negative pseudo-random integer.

      The generated integer will be from the half-open interval [0,n). If the optional parameter n is missing, Number.MAX_SAFE_INTEGER will be used instead.

      Parameters

      • n: number

        The upper bound, Number.MAX_SAFE_INTEGER if missing.

      Returns number