randint#
- deeptrack.backend.array_api_compat_ext.torch.random.randint(low: int, high: int | None = None, size: tuple[int, ...] | None = None) Tensor#
Sample integers from a uniform discrete distribution.
Mirrors numpy.random.randint.
Parameters#
- low: int
Lowest integer (inclusive) if high is provided. If high is None, this is treated as the exclusive upper bound, and low is set to 0.
- high: int | None, optional
Upper bound (exclusive).
- size: tuple[int, …] | None, optional
Output shape. If None, returns a scalar tensor.
Returns#
- torch.Tensor
Random integers in [low, high) with dtype torch.int64.
Examples#
>>> import deeptrack.backend.array_api_compat_ext.torch.random as rnd
>>> rnd.randint(5) tensor(3)
>>> rnd.randint(2, 10, (2, 3)).shape torch.Size([2, 3])