random.jumpahead: How to jump ahead exactly N steps?

Matthew Wilson matt at overlook.homelinux.net
Wed Jun 21 17:15:49 EDT 2006


The random.jumpahead documentation says this:

    Changed in version 2.3: Instead of jumping to a specific state, n steps
    ahead, jumpahead(n) jumps to another state likely to be separated by
    many steps..

I really want a way to get to the Nth value in a random series started
with a particular seed.  Is there any way to quickly do what jumpahead
apparently used to do?

I devised this function, but I suspect it runs really slowly:

def trudgeforward(n):
    '''Advance the random generator's state by n calls.'''
    for _ in xrange(n): random.random()

So any speed tips would be very appreciated.

TIA


-- 
A better way of running series of SAS programs:
http://overlook.homelinux.net/wilsonwiki/SasAndMakefiles



More information about the Python-list mailing list