Random engine class and functions to generate random numbers.
arrayfire.random.
Random_Engine
(engine_type=<RANDOM_ENGINE.PHILOX_4X32_10: 100>, seed=0, engine=None)[source]¶
Bases: object
Class to handle random number generator engines.
Specifies the type of random engine to be created. Can be one of:
RANDOM_ENGINE.PHILOX_4X32_10
RANDOM_ENGINE.THREEFRY_2X32_16
RANDOM_ENGINE.MERSENNE_GP11213
RANDOM_ENGINE.PHILOX (same as RANDOM_ENGINE.PHILOX_4X32_10)
RANDOM_ENGINE.THREEFRY (same as RANDOM_ENGINE.THREEFRY_2X32_16)
RANDOM_ENGINE.DEFAULT
Not used if engine is not None
Specifies the seed for the random engine
Not used if engine is not None
Used a handle created by the C api to create the Random_Engine.
Methods
get_seed
()
Get the seed for the random engine.
get_type
()
Get the type of the random engine.
set_seed
(seed)
Set the seed for the random engine.
set_type
(engine_type)
Set the type of the random engine.
get_seed
()[source]¶
Get the seed for the random engine.
get_type
()[source]¶
Get the type of the random engine.
set_seed
(seed)[source]¶
Set the seed for the random engine.
set_type
(engine_type)[source]¶
Set the type of the random engine.
arrayfire.random.
get_default_random_engine
()[source]¶
Get the default random engine
arrayfire.random.
get_seed
()[source]¶
Get the seed for the random number generator.
Seed for the random number generator
arrayfire.random.
randn
(d0, d1=None, d2=None, d3=None, dtype=<Dtype.f32: 0>, engine=None)[source]¶
Create a multi dimensional array containing values from a normal distribution.
Length of first dimension.
Length of second dimension.
Length of third dimension.
Length of fourth dimension.
Data type of the array.
If engine is None, uses a default engine created by arrayfire.
Multi dimensional array whose elements are sampled from a normal distribution with mean 0 and sigma of 1. - If d1 is None, out is 1D of size (d0,). - If d1 is not None and d2 is None, out is 2D of size (d0, d1). - If d1 and d2 are not None and d3 is None, out is 3D of size (d0, d1, d2). - If d1, d2, d3 are all not None, out is 4D of size (d0, d1, d2, d3).
arrayfire.random.
randu
(d0, d1=None, d2=None, d3=None, dtype=<Dtype.f32: 0>, engine=None)[source]¶
Create a multi dimensional array containing values from a uniform distribution.
Length of first dimension.
Length of second dimension.
Length of third dimension.
Length of fourth dimension.
Data type of the array.
If engine is None, uses a default engine created by arrayfire.
Multi dimensional array whose elements are sampled uniformly between [0, 1]. - If d1 is None, out is 1D of size (d0,). - If d1 is not None and d2 is None, out is 2D of size (d0, d1). - If d1 and d2 are not None and d3 is None, out is 3D of size (d0, d1, d2). - If d1, d2, d3 are all not None, out is 4D of size (d0, d1, d2, d3).
arrayfire.random.
set_default_random_engine_type
(engine_type)[source]¶
Set random engine type for default random engine.
Specifies the type of random engine to be created. Can be one of:
RANDOM_ENGINE.PHILOX_4X32_10
RANDOM_ENGINE.THREEFRY_2X32_16
RANDOM_ENGINE.MERSENNE_GP11213
RANDOM_ENGINE.PHILOX (same as RANDOM_ENGINE.PHILOX_4X32_10)
RANDOM_ENGINE.THREEFRY (same as RANDOM_ENGINE.THREEFRY_2X32_16)
RANDOM_ENGINE.DEFAULT
arrayfire.random.
set_seed
(seed=0)[source]¶
Set the seed for the random number generator.
Seed for the random number generator
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4