Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

random

Name: Anonymous 2012-01-01 23:19

hey /prog/.

is there a random number generator algorithm/library that supports something like this: use this seed, give me next nth random number? obviously it shouldn't iterate n times. I don't care if it is not that random.

there is probably something very simple for this but I can't get my head around it.

Name: Anonymous 2012-01-02 1:00

>>8

yeah it's a really simply technique. It makes results that look kind of random, and it visits every number exactly once, until it starts to repeat. Like if MAX_INT is 12, and you let the large number be 7, then the sequence is:


0,
7,
14-12=2,
9,
16-12=4,
11,
18-12=6,
13-12=1,
8,
15-12=3,
10,
17-12=5,
12-12=0,


0,7,2,9,4,11,6,1,8,3,10,5

It looks sorta random. cept for

0,7,2, 9
1,8,3,10

looks a little suspicious.


>>9 thanks for the reference. I must better my primitive techniques.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List