Talk:Linear congruential generator: Difference between revisions

From Rosetta Code
Content added Content deleted
(example sequences)
Line 16: Line 16:
== Example Sequences==
== Example Sequences==
It occurs to me that the BSD LCRNG can produce an overflow of 32 bit words. It would be nice to have a sequence that exercises this to ensure the behavior is reproduced. --[[User:Dgamey|Dgamey]] 04:58, 8 July 2011 (UTC)
It occurs to me that the BSD LCRNG can produce an overflow of 32 bit words. It would be nice to have a sequence that exercises this to ensure the behavior is reproduced. --[[User:Dgamey|Dgamey]] 04:58, 8 July 2011 (UTC)
: Overflow how? Intermediate results can be done with larger integer types. --[[User:Ledrug|Ledrug]] 06:18, 8 July 2011 (UTC)

Revision as of 06:18, 8 July 2011

OK, What's the task

Not to be impatient but so far this is a nice explanation of LCRNG's but there is no task.

There are other tasks with LCRNGs like Random_number_generator_(included) which pertains to what is built in.

What do we need to do to solve this task? --Dgamey 01:06, 2 July 2011 (UTC)

The task with built-in RNGs doesn't necessarily map. There's no guarantee that the built-in RNG is a linear congruential generator; that's just the most common implementation option. –Donal Fellows 15:42, 2 July 2011 (UTC)
Still there is no task see "insert task here". It's basically encyclopedic. --Dgamey 02:29, 3 July 2011 (UTC)

On the task

I kinda remember something about not all seeds being good? a seed of zero for example? --Paddy3118 05:07, 7 July 2011 (UTC)

Shouldn't be. Because of the coprimality between a and m, all values from 0 to m-1 will appear exactly once in a cycle, so any seed is as good as another. You may be thinking the situation where people choose predictable seeds, such as 0, current time, process id, etc while trying to use PRNG for sensitive work, giving an attacker a higher chance of success at finding the pseudo random sequence. --Ledrug 05:23, 7 July 2011 (UTC)
Aha! Thanks Ledrug. I found what I was thinking of - I was thinking of LFSR's. --Paddy3118 06:52, 7 July 2011 (UTC)

Example Sequences

It occurs to me that the BSD LCRNG can produce an overflow of 32 bit words. It would be nice to have a sequence that exercises this to ensure the behavior is reproduced. --Dgamey 04:58, 8 July 2011 (UTC)

Overflow how? Intermediate results can be done with larger integer types. --Ledrug 06:18, 8 July 2011 (UTC)