Skip to content

RandomIntegers(low, high, bounds=Bounds.INCLUDED) Source

Bases: Distribution

Whole numbers drawn with the same chance from low to high.

Both bounds can be drawn by default: RandomIntegers(low=1, high=6) rolls a die.

Added in version 0.1.0

Parameters:

  • low (int)

    Low bound.

  • high (int)

    High bound.

  • bounds (Bounds, default: Bounds.INCLUDED)

    Which bounds can be drawn. Both are included by default.

Raises:

  • InvalidTypeError

    When a setting is not of the type its annotation names.

  • InvalidBoundsError

    When no whole number lies between the bounds, such as low greater than high, or low=3, high=4 with both bounds excluded.

Examples:

import numdaplot as ndp

dice = ndp.RandomIntegers(low=1, high=6)
ndp.Array.random(dice, shape=ndp.Shape([5]), seed=0)
# Array([6, 4, 4, 2, 2], dtype=INT64)