spectrochempy.random
- random(size=None, dtype=None, **kwargs)[source]
Return random floats in the half-open interval [0.0, 1.0).
Results are from the “continuous uniform” distribution over the stated interval.
Note
To sample \(\\mathrm{Uniform}[a, b)\) with \(b > a\), multiply the output of random by (b-a) and add a, i.e.: \((b - a) * \mathrm{random}() + a\).
- 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.
dtype (dtype, optional) – Desired dtype of the result, only float64 and float32 are supported. The default value is np.float64.
**kwargs – Keywords argument used when creating the returned object, such as units, name, title, etc…
- Returns:
random – Array of random floats of shape size (unless size=None, in which case a single float is returned).