Random Sensor: seed

seed
  • gets/sets the initial Seed of the generator

Type: 
  • integer

Range:

  • 0 to 1000
Random Sensor:
  • If the seed is 0, the generator will produce the same value on every call.
  • Sends random pulses to the controller(s).
  • One positive pulse is immediately followed by a negative pulse.
Sample Code


################  Get the Random sensor Seed

# import bge module
import bge

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

# get the sensor attached to the controller
# my sensor is named Shuffle

sen = cont.sensors["Shuffle"]

# get the Seed
get_seed = sen.seed
 
Sample Code


################  Set the Random Sensor Seed

# import bge module
import bge

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

# get the sensor attached to the controller
# my sensor is named Shuffle

sen = cont.sensors["Shuffle"]

# Set the seed
sen.seed = 16