Tips for select the best seed (pseudorandom numbers)

178 Views Asked by At

Good day

I'm working with Linear Congruential Methods and Middle-square Method, I want to know if there is a way to choose the best seed. "Best seed" mean the max period, I know that:

Linear Congruential Method

  • Don't use zero

  • Don't use even numbers

  • Let $r_{1+i}=(a+cr_i) mod (m)$: $m=2^g$ where $g$ is integer; $a=1+4k$ where $k$ is integer; $c$ will be relatively prime with $m$

Middle-square Method

  • Don't use zero

  • Don't use numbers where half is formed with zeros

1

There are 1 best solutions below

0
On BEST ANSWER

Partial answer: Knuth (Seminumerical algorithms, Theorem A), gives a complete characterisation for maximal period length:

  1. c is relative prime to m
  2. b=a-1 is a muliple of p, for each p dividing m
  3. b is a multiple of 4, if m is multiple of 4.

The case $c=0$ is handled in Theorems B...D.

Hints for the middle-square algorithm are given in exercise/answer 3.1.6.