package np

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type tag = [
  1. | `BitGenerator
]
type t = [ `BitGenerator | `Object ] Obj.t
val of_pyobject : Py.Object.t -> t
val to_pyobject : [> tag ] Obj.t -> Py.Object.t
val create : ?seed:[ `I of int | `PyObject of Py.Object.t ] -> unit -> t

BitGenerator(seed=None)

Base Class for generic BitGenerators, which provide a stream of random bits based on different algorithms. Must be overridden.

Parameters ---------- seed : None, int, array_like[ints], 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_likeints`` 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.

Attributes ---------- lock : threading.Lock Lock instance that is shared so that the same BitGenerator can be used in multiple Generators without corrupting the state. Code that generates values from a bit generator should hold the bit generator's lock.

See Also ------- SeedSequence

val random_raw : ?size:int list -> [> tag ] Obj.t -> Py.Object.t

random_raw(self, size=None)

Return randoms as generated by the underlying BitGenerator

Parameters ---------- 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.

Returns ------- out : uint or ndarray Drawn samples.

Notes ----- 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.

val lock : t -> Py.Object.t

Attribute lock: get value or raise Not_found if None.

val lock_opt : t -> Py.Object.t option

Attribute lock: get value as an option.

val to_string : t -> string

Print the object to a human-readable representation.

val show : t -> string

Print the object to a human-readable representation.

val pp : Format.formatter -> t -> unit

Pretty-print the object to a formatter.

OCaml

Innovation. Community. Security.