|
-
May 2nd, 2010, 05:48 PM
#10
Re: Random numbers
A proposal: May be the period of generator is shorter than 1000. Let us number the given sequence from 1 to 1000. Search for 1000-th number among first 999. If found, say it's i-th check whether (i-1) == 999, (i-2) == 998 and so on(1). Tip: search backwards i.e. from 999 to 1. You should find the loop, then determinate its length. This loop is called a period of PRNG.
The period of standard rand() is about 230, as I remember.
I hope this will help you. Good luck!
P.S.
(1) Thats for the case when inner state of generator is "wider" than output. For example, rand_seed = (rand_seed * 25173 + 13849) % 65536 has a period of 65536, but the you "shrink" its output with random() % 200.
Last edited by andrey_zh; May 2nd, 2010 at 06:01 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|