Random Actuator Bool Bernoulli: setBoolBernouilli

setBoolBernouilli(Chance)
  • Sets the random generator to produce a bool using a Bernouilli distribution.

Chance: 
  • Type: float number
     
  • Range: 0.0 to 1.0
     
  • 0.0  will alway generate False.
     
  • 1.0 will always generate True.
Bool Bernoulli:
  • Random Generator returns True or False.
     
  • Starting seed has no effect.
     
  • Chance of it being True or False is determined by a percentage you choose.
Sample Code


################  set the Random Actuator to produce a Bernoulli boolean

# import bge module
import bge

# get the controller
cont = bge.logic.getCurrentController()

# get the actuator attached to the controller
# my actuator is named Flip

act = cont.actuators["Flip"]

# set Random Actuator to 50/50
act.setBoolBernouilli(0.5)