from direct.showbase.RandomNumGen import RandomNumGen, randHash

RandomNumGen module: contains the RandomNumGen class

Inheritance diagram

Inheritance diagram of direct.showbase.RandomNumGen

class RandomNumGen(seed)[source]

Bases: object

__init__(self, seed)[source]

seed must be an integer or another RandomNumGen

choice(self, seq)[source]

returns a random element from seq

notify = <direct.directnotify.Notifier.Notifier object>
randint(self, a, b)[source]

returns integer in [a, b]


returns random float in [0.0, 1.0)

randrange([start, ]stop[, step])[source]

same as choice(range(start, stop[, step])) without construction of a list

shuffle(self, x)[source]

randomly shuffles x in-place


this returns a random 16-bit integer, given a seed integer. It will always return the same output given the same input. This is useful for repeatably mapping numbers with predictable bit patterns (i.e. doIds or zoneIds) to numbers with random bit patterns