Skip to content
fn

random_randint_storage

→Storage
int random_randint_storage(const int & shape, int low, int high, Dtype dt, Device device, Generator & gen)

Generate uniform random integers in the half-open interval [low, high).

Uses batched uint32 generation from gen for throughput, then folds the raw bytes into the requested integer range.

Parameters

shapeconst Shape&
Output shape.
lowstd::int64_t
Inclusive lower bound.
highstd::int64_t
Exclusive upper bound (high > low).
dtDtype
Output dtype; I32 or I64 only.
deviceDevice
Target device.
Random-number generator.

Returns

Storage

New storage of shape shape with integer samples.