Module SCA_RandomActuator :: Class SCA_RandomActuator

Class SCA_RandomActuator

source code

SCA_ILogicBrick.SCA_ILogicBrick --+    
                                  |    
        SCA_IActuator.SCA_IActuator --+
                                      |
                                     SCA_RandomActuator

Random Actuator

Instance Methods
 
setSeed(seed)
Sets the seed of the random number generator.
source code
integer
getSeed()
Returns the initial seed of the generator.
source code
float
getPara1()
Returns the first parameter of the active distribution.
source code
float
getPara2()
Returns the second parameter of the active distribution.
source code
distribution type
getDistribution()
Returns the type of random distribution.
source code
 
setProperty(property)
Set the property to which the random value is assigned.
source code
string
getProperty()
Returns the name of the property to set.
source code
 
setBoolConst(value)
Sets this generator to produce a constant boolean value.
source code
 
setBoolUniform()
Sets this generator to produce a uniform boolean distribution.
source code
 
setBoolBernouilli(value)
Sets this generator to produce a Bernouilli distribution.
source code
 
setIntConst(value)
Sets this generator to always produce the given value.
source code
 
setIntUniform(lower_bound, upper_bound)
Sets this generator to produce a random value between the given lower and upper bounds (inclusive).
source code
 
setIntPoisson(value)
Generate a Poisson-distributed number.
source code
 
setFloatConst(value)
Always generate the given value.
source code
 
setFloatUniform(lower_bound, upper_bound)
Generates a random float between lower_bound and upper_bound with a uniform distribution.
source code
 
setFloatNormal(mean, standard_deviation)
Generates a random float from the given normal distribution.
source code
 
setFloatNegativeExponential(half_life)
Generate negative-exponentially distributed numbers.
source code

Inherited from SCA_ILogicBrick.SCA_ILogicBrick: getExecutePriority, getOwner, setExecutePriority

Method Details

setSeed(seed)

source code 

Sets the seed of the random number generator.

Equal seeds produce equal series. If the seed is 0, the generator will produce the same value on every call.

getPara1()

source code 

Returns the first parameter of the active distribution.

Refer to the documentation of the generator types for the meaning of this value.
Returns: float

getPara2()

source code 

Returns the second parameter of the active distribution.

Refer to the documentation of the generator types for the meaning of this value.
Returns: float

getDistribution()

source code 
Returns the type of random distribution.
Returns: distribution type
KX_RANDOMACT_BOOL_CONST, KX_RANDOMACT_BOOL_UNIFORM, KX_RANDOMACT_BOOL_BERNOUILLI, KX_RANDOMACT_INT_CONST, KX_RANDOMACT_INT_UNIFORM, KX_RANDOMACT_INT_POISSON, KX_RANDOMACT_FLOAT_CONST, KX_RANDOMACT_FLOAT_UNIFORM, KX_RANDOMACT_FLOAT_NORMAL, KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL

setProperty(property)

source code 

Set the property to which the random value is assigned.

If the generator and property types do not match, the assignment is ignored.
Parameters:
  • property (string) - The name of the property to set.

setBoolConst(value)

source code 
Sets this generator to produce a constant boolean value.
Parameters:
  • value (boolean) - The value to return.

setBoolUniform()

source code 

Sets this generator to produce a uniform boolean distribution.

The generator will generate True or False with 50% chance.

setBoolBernouilli(value)

source code 
Sets this generator to produce a Bernouilli distribution.
Parameters:
  • value (float) - Specifies the proportion of False values to produce.
    • 0.0: Always generate True
    • 1.0: Always generate False

setIntConst(value)

source code 
Sets this generator to always produce the given value.
Parameters:
  • value (integer) - the value this generator produces.

setIntUniform(lower_bound, upper_bound)

source code 
Sets this generator to produce a random value between the given lower and upper bounds (inclusive).

setIntPoisson(value)

source code 

Generate a Poisson-distributed number.

This performs a series of Bernouilli tests with parameter value. It returns the number of tries needed to achieve succes.

setFloatConst(value)

source code 
Always generate the given value.

setFloatUniform(lower_bound, upper_bound)

source code 
Generates a random float between lower_bound and upper_bound with a uniform distribution.

setFloatNormal(mean, standard_deviation)

source code 
Generates a random float from the given normal distribution.
Parameters:
  • mean (float) - The mean (average) value of the generated numbers
  • standard_deviation (float) - The standard deviation of the generated numbers.

setFloatNegativeExponential(half_life)

source code 

Generate negative-exponentially distributed numbers.

The half-life 'time' is characterized by half_life.