# Stateless and deterministic number generation

I want a stateless deterministic pseudorandom generator.

Following number generation is deterministic, whenever I give $constantValue$, and index it will value $A$

$A = Hash(constantValue + index)$

$index$ ranges from $0$ to infinity.

It is a deterministic value generation, but I have to keep state (index) to avoid generation of one value more than once.

My question is how can I make it stateless ( I do not have to keep a right index to avoid generation of one value more than once.)

I want to avoid generating one number (A) more than once I have to keep right index (state).

At the same time, I want value generation to be deterministic.

State here can be considered as---Merkle Signature scheme is stateful signature scheme, but SPHINCS is a stateless signature scheme.

Note that hash and a constant value is mandatory to be part of a pseudorandom generation.

• Possibly you could use time as a universal counter / index. Or use a challenge-response protocol. Or even have a trusted third party to maintain the state or index. But all those solutions would depend on the use case if they are feasible. – Maarten Bodewes Mar 9 '18 at 12:52
• @MaartenBodewes in case I use time as index, that is not deterministic. In order to regenerate, i have to store the time that becomes stateful. – Infinity Mar 9 '18 at 12:55
• Neither of the workarounds above are completely stateless. Probably I should have used that word instead of solutions. However, possibly you wanted some workarounds after reading poncho's answer ;) – Maarten Bodewes Mar 9 '18 at 12:57

I want a stateless deterministic pseudorandom generator.

I don't see how that can work.

"Stateless" - the generator is always in the same state

"Deterministic" - given the same state (and inputs, but there's no inputs here), the generator always generates the same output.

Hence, you end up with something that always generates the same output; hardly pseudorandom.

The comparison with SPHINCS doesn't appear to be quite valid; the original SPHINCS is not deterministic (it selects the path through the hypertree randomly); you could make it deterministic (by depending on the message being signed to seed your randomness), but that's making it depend on an input that your pseudorandom number generator doesn't have.

• Is there anything that can be stateless and deterministic at the same time. – Infinity Mar 9 '18 at 13:07
• Of course there is. $0^{len}$ would come to mind, were $len$ is the required output length. It is however not exactly random (it is rather the opposite: it is exactly not random). – Maarten Bodewes Mar 9 '18 at 14:08
• @Infinity: actually, lots of things can be stateless and deterministic, but they take inputs – poncho Mar 9 '18 at 14:10
• can you refer me some article or paper – Infinity Mar 9 '18 at 16:25