View Single Post
Old 05-15-2006, 07:02 AM
halley halley is offline
Join Date: Oct 2005
Posts: 27
That module defines a class called whrandom. You must create an instance of the whrandom class, and then that instance can provide a stream of numbers. This works a bit differently from a simple function.

import whrandom
rng = whrandom.whrandom()
for loop in range(10):
    num = rng.randrange(1, 5)
    print num
This is a complete example. It loads the whrandom module. It creates an instance of the whrandom class, and we refer to it with the variable "rng". The instance decides on a seed to begin automatically. It then uses that instance to fetch new random numbers. Keep the instance for as long as you need to generate numbers.
[ e d h a l l e y ]
I'm just a user, not a representative of WorldViz. Hope I've been helpful.
Reply With Quote