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:
-
InvalidTypeErrorWhen a setting is not of the type its annotation names.
-
InvalidBoundsErrorWhen no whole number lies between the bounds, such as
lowgreater thanhigh, orlow=3, high=4with 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)