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 0:04

>>1

would this work?


unsigned int random(unsigned int n) {
  return n*__REALLY_BIG_NUMBER_THAT_IS_RELATIVELY_PRIME_TO_MAX_INT__;
}

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