colour.algebra.random_triplet_generator#

colour.algebra.random_triplet_generator(size: int, limits: ArrayLike = np.array([[0, 1], [0, 1], [0, 1]]), random_state: numpy.random.mtrand.RandomState = RANDOM_STATE) numpy.ndarray[source]#

Return a generator yielding random triplets.

Parameters
  • size (int) – Generator size.

  • limits (ArrayLike) – Random values limits on each triplet axis.

  • random_state (numpy.random.mtrand.RandomState) – Mersenne Twister pseudo-random number generator.

Returns

Random triplet generator.

Return type

numpy.ndarray

Notes

  • The test is assuming that np.random.RandomState() definition will return the same sequence no matter which OS or Python version is used. There is however no formal promise about the prng sequence reproducibility of either Python or Numpy implementations, see [Laurent12].

Examples

>>> from pprint import pprint
>>> prng = np.random.RandomState(4)
>>> random_triplet_generator(10, random_state=prng)
... 
array([[ 0.9670298...,  0.7793829...,  0.4361466...],
       [ 0.5472322...,  0.1976850...,  0.9489773...],
       [ 0.9726843...,  0.8629932...,  0.7863059...],
       [ 0.7148159...,  0.9834006...,  0.8662893...],
       [ 0.6977288...,  0.1638422...,  0.1731654...],
       [ 0.2160895...,  0.5973339...,  0.0749485...],
       [ 0.9762744...,  0.0089861...,  0.6007427...],
       [ 0.0062302...,  0.3865712...,  0.1679721...],
       [ 0.2529823...,  0.0441600...,  0.7333801...],
       [ 0.4347915...,  0.9566529...,  0.4084438...]])