Module SCA_RandomActuator

Source Code for Module SCA_RandomActuator

  1  # $Id: SCA_RandomActuator.py 2615 2004-06-02 12:43:27Z kester $ 
  2  # Documentation for SCA_RandomActuator 
  3  from SCA_IActuator import * 
  4   
5 -class SCA_RandomActuator(SCA_IActuator):
6 """ 7 Random Actuator 8 """
9 - def setSeed(seed):
10 """ 11 Sets the seed of the random number generator. 12 13 Equal seeds produce equal series. If the seed is 0, 14 the generator will produce the same value on every call. 15 16 @type seed: integer 17 """
18 - def getSeed():
19 """ 20 Returns the initial seed of the generator. 21 22 @rtype: integer 23 """
24 - def getPara1():
25 """ 26 Returns the first parameter of the active distribution. 27 28 Refer to the documentation of the generator types for the meaning 29 of this value. 30 31 @rtype: float 32 """
33 - def getPara2():
34 """ 35 Returns the second parameter of the active distribution. 36 37 Refer to the documentation of the generator types for the meaning 38 of this value. 39 40 @rtype: float 41 """
42 - def getDistribution():
43 """ 44 Returns the type of random distribution. 45 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 51 """
52 - def setProperty(property):
53 """ 54 Set the property to which the random value is assigned. 55 56 If the generator and property types do not match, the assignment is ignored. 57 58 @type property: string 59 @param property: The name of the property to set. 60 """
61 - def getProperty():
62 """ 63 Returns the name of the property to set. 64 65 @rtype: string 66 """
67 - def setBoolConst(value):
68 """ 69 Sets this generator to produce a constant boolean value. 70 71 @param value: The value to return. 72 @type value: boolean 73 """
74 - def setBoolUniform():
75 """ 76 Sets this generator to produce a uniform boolean distribution. 77 78 The generator will generate True or False with 50% chance. 79 """
80 - def setBoolBernouilli(value):
81 """ 82 Sets this generator to produce a Bernouilli distribution. 83 84 @param value: Specifies the proportion of False values to produce. 85 - 0.0: Always generate True 86 - 1.0: Always generate False 87 @type value: float 88 """
89 - def setIntConst(value):
90 """ 91 Sets this generator to always produce the given value. 92 93 @param value: the value this generator produces. 94 @type value: integer 95 """
96 - def setIntUniform(lower_bound, upper_bound):
97 """ 98 Sets this generator to produce a random value between the given lower and 99 upper bounds (inclusive). 100 101 @type lower_bound: integer 102 @type upper_bound: integer 103 """
104 - def setIntPoisson(value):
105 """ 106 Generate a Poisson-distributed number. 107 108 This performs a series of Bernouilli tests with parameter value. 109 It returns the number of tries needed to achieve succes. 110 111 @type value: float 112 """
113 - def setFloatConst(value):
114 """ 115 Always generate the given value. 116 117 @type value: float 118 """
119 - def setFloatUniform(lower_bound, upper_bound):
120 """ 121 Generates a random float between lower_bound and upper_bound with a 122 uniform distribution. 123 124 @type lower_bound: float 125 @type upper_bound: float 126 """
127 - def setFloatNormal(mean, standard_deviation):
128 """ 129 Generates a random float from the given normal distribution. 130 131 @type mean: float 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. 135 """
136 - def setFloatNegativeExponential(half_life):
137 """ 138 Generate negative-exponentially distributed numbers. 139 140 The half-life 'time' is characterized by half_life. 141 142 @type half_life: float 143 """
144