class cupy.random.Philox4x3210(seed=None, *, size=256000)

BitGenerator that uses cuRAND Philox4x3210 device generator.

This generator allocates the state using the cuRAND device API.

  • seed (int, array_like[ints], numpy.random.SeedSequence, optional) – A seed to initialize the BitGenerator. If None, then fresh, unpredictable entropy will be pulled from the OS. If an int or array_like[ints] is passed, then it will be passed to ~`numpy.random.SeedSequence` to derive the initial BitGenerator state. One may also pass in a SeedSequence instance.

  • size (int) – Maximum number of samples that can be generated at once. defaults to 1000 * 256.


random_raw(self, size=None, output=True)

Return randoms as generated by the underlying BitGenerator.

  • size (int or tuple of ints, optional) – Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.

  • output (bool, optional) – Output values. Used for performance testing since the generated values are not returned.


Drawn samples.

Return type



This method directly exposes the the raw underlying pseudo-random number generator. All values are returned as unsigned 64-bit values irrespective of the number of bits produced by the PRNG. See the class docstring for the number of bits returned.

__eq__(value, /)

Return self==value.

__ne__(value, /)

Return self!=value.

__lt__(value, /)

Return self<value.

__le__(value, /)

Return self<=value.

__gt__(value, /)

Return self>value.

__ge__(value, /)

Return self>=value.


generator = 2