Cyclops Tensor Framework parallel arithmetic on multidimensional arrays
ctf.random Namespace Reference

## Functions

def seed (seed)

def all_seed (seed)

def random (shape, sp=None, p=None, dtype=None)

## Function Documentation

 def ctf.random.all_seed ( seed )
```all_seed(seed)
Seed the random tensor generator with the same seed in all processes.

Parameters
----------
seed: int
Seed for random.
```

Definition at line 28 of file random.pyx.

References CTF_int.init_rng().

 def ctf.random.random ( shape, sp = `None`, p = `None`, dtype = `None` )
```random(shape, sp=None, p=None, dtype=None)
Return random float (in half-open interval [0.0, 1.0)) tensor with specified parameters. Result tensor is from the continuous uniform distribution over the interval.

Parameters
----------
shape: tensor_like
Input tensor with 1-D or 2-D dimensions. If A is 1-D tensor, return a 2-D tensor with A on diagonal.

sp: bool, optional
When sp is specified True, the output tensor will be sparse.

p: float, optional
When sp is True, p specifies the fraction of sparsity for the sparse tensor.

dtype: data-type, optional
Not supportted in current CTF Python.

Returns
-------
output: tensor
Random float tensor.

Examples
--------
>>> import ctf
>>> import ctf.random as random
>>> random.random([2, 2])
array([[0.95027513, 0.79755613],
[0.27834548, 0.55310684]])
```

Definition at line 40 of file random.pyx.

 def ctf.random.seed ( seed )
```seed(seed)
Seed the random tensor generator.

Parameters
----------
seed: int
Seed for random. Each process has the seed with `seed + get_universe().rank`.
```

Definition at line 15 of file random.pyx.

References CTF.get_universe(), and CTF_int.init_rng().