1
# $Id: SCA_RandomActuator.py 15444 2008-07-05 17:05:05Z lukep $
2
# Documentation for SCA_RandomActuator
3
from SCA_IActuator import *
5
class SCA_RandomActuator(SCA_IActuator):
11
Sets the seed of the random number generator.
13
Equal seeds produce equal series. If the seed is 0,
14
the generator will produce the same value on every call.
20
Returns the initial seed of the generator.
26
Returns the first parameter of the active distribution.
28
Refer to the documentation of the generator types for the meaning
35
Returns the second parameter of the active distribution.
37
Refer to the documentation of the generator types for the meaning
42
def getDistribution():
44
Returns the type of random distribution.
46
@rtype: distribution type
47
@return: KX_RANDOMACT_BOOL_CONST, KX_RANDOMACT_BOOL_UNIFORM, KX_RANDOMACT_BOOL_BERNOUILLI,
48
KX_RANDOMACT_INT_CONST, KX_RANDOMACT_INT_UNIFORM, KX_RANDOMACT_INT_POISSON,
49
KX_RANDOMACT_FLOAT_CONST, KX_RANDOMACT_FLOAT_UNIFORM, KX_RANDOMACT_FLOAT_NORMAL,
50
KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL
52
def setProperty(property):
54
Set the property to which the random value is assigned.
56
If the generator and property types do not match, the assignment is ignored.
58
@type property: string
59
@param property: The name of the property to set.
63
Returns the name of the property to set.
67
def setBoolConst(value):
69
Sets this generator to produce a constant boolean value.
71
@param value: The value to return.
76
Sets this generator to produce a uniform boolean distribution.
78
The generator will generate True or False with 50% chance.
80
def setBoolBernouilli(value):
82
Sets this generator to produce a Bernouilli distribution.
84
@param value: Specifies the proportion of False values to produce.
85
- 0.0: Always generate True
86
- 1.0: Always generate False
89
def setIntConst(value):
91
Sets this generator to always produce the given value.
93
@param value: the value this generator produces.
96
def setIntUniform(lower_bound, upper_bound):
98
Sets this generator to produce a random value between the given lower and
99
upper bounds (inclusive).
101
@type lower_bound: integer
102
@type upper_bound: integer
104
def setIntPoisson(value):
106
Generate a Poisson-distributed number.
108
This performs a series of Bernouilli tests with parameter value.
109
It returns the number of tries needed to achieve succes.
113
def setFloatConst(value):
115
Always generate the given value.
119
def setFloatUniform(lower_bound, upper_bound):
121
Generates a random float between lower_bound and upper_bound with a
122
uniform distribution.
124
@type lower_bound: float
125
@type upper_bound: float
127
def setFloatNormal(mean, standard_deviation):
129
Generates a random float from the given normal distribution.
132
@param mean: The mean (average) value of the generated numbers
133
@type standard_deviation: float
134
@param standard_deviation: The standard deviation of the generated numbers.
136
def setFloatNegativeExponential(half_life):
138
Generate negative-exponentially distributed numbers.
140
The half-life 'time' is characterized by half_life.
142
@type half_life: float