Module GameTypes :: Class SCA_RandomActuator
[frames] | no frames]

Class SCA_RandomActuator

PyObjectPlus --+            
               |            
          CValue --+        
                   |        
     SCA_ILogicBrick --+    
                       |    
           SCA_IActuator --+
                           |
                          SCA_RandomActuator

Random Actuator

Properties:

Instance Methods
 
setBoolConst(value)
Sets this generator to produce a constant boolean value.
 
setBoolUniform()
Sets this generator to produce a uniform boolean distribution.
 
setBoolBernouilli(value)
Sets this generator to produce a Bernouilli distribution.
 
setIntConst(value)
Sets this generator to always produce the given value.
 
setIntUniform(lower_bound, upper_bound)
Sets this generator to produce a random value between the given lower and upper bounds (inclusive).
 
setIntPoisson(value)
Generate a Poisson-distributed number.
 
setFloatConst(value)
Always generate the given value.
 
setFloatUniform(lower_bound, upper_bound)
Generates a random float between lower_bound and upper_bound with a uniform distribution.
 
setFloatNormal(mean, standard_deviation)
Generates a random float from the given normal distribution.
 
setFloatNegativeExponential(half_life)
Generate negative-exponentially distributed numbers.
bool
isA(game_type)
Check if this is a type or a subtype game_type. (Inherited from GameTypes.PyObjectPlus)
    Deprecated
 
setSeed(seed)
Sets the seed of the random number generator.
integer
getSeed()
Returns the initial seed of the generator.
float
getPara1()
Returns the first parameter of the active distribution.
float
getPara2()
Returns the second parameter of the active distribution.
distribution type
getDistribution()
Returns the type of random distribution.
 
setProperty(property)
Set the property to which the random value is assigned.
string
getProperty()
Returns the name of the property to set.
integer
getExecutePriority()
Gets the execution priority of this logic brick. (Inherited from GameTypes.SCA_ILogicBrick)
string
getName()
Returns the name of the CValue. (Inherited from GameTypes.CValue)
KX_GameObject
getOwner()
Gets the game object associated with this logic brick. (Inherited from GameTypes.SCA_ILogicBrick)
 
setExecutePriority(priority)
Sets the priority of this logic brick. (Inherited from GameTypes.SCA_ILogicBrick)
Instance Variables
integer, read-only distribution
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
int executePriority
This determines the order controllers are evaluated, and actuators are activated (lower priority is executed first). (Inherited from GameTypes.SCA_ILogicBrick)
bool invalid
Test if the object has been freed by the game engine and is no longer valid. (Inherited from GameTypes.PyObjectPlus)
string name
The name of this CValue derived object (read-only). (Inherited from GameTypes.SCA_ILogicBrick)
KX_GameObject or None in exceptional cases. owner
The game object this logic brick is attached to (read-only). (Inherited from GameTypes.SCA_ILogicBrick)
float, read-only para1
the first parameter of the active distribution.
float, read-only para2
the second parameter of the active distribution.
string propName
the name of the property to set with the random value.
integer seed
Seed of the random number generator.
Method Details

setBoolConst(value)

 

Sets this generator to produce a constant boolean value.

Parameters:
  • value (boolean) - The value to return.

setBoolUniform()

 

Sets this generator to produce a uniform boolean distribution.

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

setBoolBernouilli(value)

 

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)

 

Sets this generator to always produce the given value.

Parameters:
  • value (integer) - the value this generator produces.

setIntUniform(lower_bound, upper_bound)

 

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

Parameters:
  • lower_bound (integer)
  • upper_bound (integer)

setIntPoisson(value)

 

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.

Parameters:
  • value (float)

setFloatConst(value)

 

Always generate the given value.

Parameters:
  • value (float)

setFloatUniform(lower_bound, upper_bound)

 

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

Parameters:
  • lower_bound (float)
  • upper_bound (float)

setFloatNormal(mean, standard_deviation)

 

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)

 

Generate negative-exponentially distributed numbers.

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

Parameters:
  • half_life (float)

setSeed(seed)

 

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.

Parameters:
  • seed (integer)

Deprecated: Use the seed attribute instead.

getSeed()

 

Returns the initial seed of the generator.

Returns: integer

Deprecated: Use the seed attribute instead.

getPara1()

 

Returns the first parameter of the active distribution.

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

Returns: float

Deprecated: Use the para1 attribute instead.

getPara2()

 

Returns the second parameter of the active distribution.

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

Returns: float

Deprecated: Use the para2 attribute instead.

getDistribution()

 

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

Deprecated: Use the distribution attribute instead.

setProperty(property)

 

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.

Deprecated: Use the propName attribute instead.

getProperty()

 

Returns the name of the property to set.

Returns: string

Deprecated: Use the propName attribute instead.


Instance Variable Details

para1

the first parameter of the active distribution. Refer to the documentation of the generator types for the meaning of this value.
Type:
float, read-only

para2

the second parameter of the active distribution. Refer to the documentation of the generator types for the meaning of this value.
Type:
float, read-only

propName

the name of the property to set with the random value. If the generator and property types do not match, the assignment is ignored.
Type:
string

seed

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.
Type:
integer