0
$\begingroup$

Given:

ns_num(n, seed, modulo, incrementor) = (seed + n * incrementor) % modulo 

n is in range $[0,10000000)$

What value of seed, modulo, and increment can I use such that ns_num yields only values from $62^5$ to $(62^6 - 1)$, and such that no values appear more than once for any given n; where seed, modulo, and incrementor are the same for each call of ns_num.

The point of this function is that I want ns_num to generate a somewhat random sequence of numbers that don't repeat.

My understanding is that modulo and incrementor must be prime to ensure no repeating number.

Is this possible?

  • 0
    What does "Seed" and "increment" mean in programming language?2011-06-07
  • 0
    @DJC: Nothing. They are just numbers here.2011-06-07

2 Answers 2