Package topo :: Package numbergen :: Module basic :: Class RandomDistribution
[hide private]
[frames] | no frames]

Class RandomDistribution

source code


Python's random module provides the Random class, which can be instantiated to give an object that can be asked to generate numbers from any of several different random distributions (e.g. uniform, Gaussian).

To make it easier to use these, Topographica provides here a hierarchy of classes, each tied to a particular random distribution. This allows setting parameters on creation rather than passing them each call, and allows pickling to work properly.

The underlying random.Random() instance and all its methods can be accessed from the 'random_generator' attribute.

Nested Classes [hide private]

Inherited from param.parameterized.Parameterized: __metaclass__

Instance Methods [hide private]
 
__init__(self, **params)
Initialize a new Random() instance and store the supplied positional and keyword arguments.
source code
 
__call__(self) source code

Inherited from NumberGenerator: __abs__, __add__, __div__, __floordiv__, __mod__, __mul__, __neg__, __pos__, __pow__, __radd__, __rdiv__, __rfloordiv__, __rmod__, __rmul__, __rpow__, __rsub__, __rtruediv__, __sub__, __truediv__

Inherited from param.parameterized.Parameterized: __getstate__, __repr__, __setstate__, __str__, debug, defaults, force_new_dynamic_value, get_param_values, get_value_generator, inspect_value, message, print_param_values, script_repr, set_default, set_dynamic_time_fn, set_param, state_pop, state_push, verbose, warning

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Methods [hide private]

Inherited from param.parameterized.Parameterized: params, print_param_defaults

Class Variables [hide private]
  __abstract = True
bool(x) -> bool
  name = <param.parameterized.String object at 0xb1ff42c>
String identifier for this object.

Inherited from param.parameterized.Parameterized: print_level

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, **params)
(Constructor)

source code 

Initialize a new Random() instance and store the supplied positional and keyword arguments.

If seed=X is specified, sets the Random() instance's seed. Otherwise, calls the instance's jumpahead() method to get a state very likely to be different from any just used.

Overrides: object.__init__

__call__(self)
(Call operator)

source code 
Overrides: NumberGenerator.__call__

Class Variable Details [hide private]

__abstract

bool(x) -> bool

Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

Value:
True