# Shuffleless PRNG function with non-repeating values?

I need a simple PRNG function of type: Integer = PRNG(n, maxval) as I would like to count from 0 to maxval, not in a linear manner, but in a pseudorandom manner where I still use every value, but only once. For example, "0 to maxval=9" might result in "3,8,4,5,1,9,0,2,6,7", and if I asked the function for "Integer = PRNG(3)" in this case it would return the third value which is 4. (For my actual need maxval is always 64bit so 0xFFFFFFFFFFFFFFFF)

Im hoping this can be accomplished without shuffling a pre-filled array? My googling suggests perhaps a "feedback register" of sorts could be what I'm after but ive got no idea which. Thankyou

ps. are there any CPRNG secure versions of this? I dont need that level of security - PRNG is fine, but just wondering!

• "without shuffles/arrays" seems like a rather arbitrary requirement. $\;$ – user991 Jul 22 '15 at 1:22
• So there's no way of doing this without creating a 64bit array with values 0 to FFFFFFFFFFFFFFFF and shuffling that? seems expensive and inefficient! – David Jul 22 '15 at 1:47
• There is a much cheaper and more efficient method; it just only does the $\hspace{1.76 in}$ currently-relevant parts of each shuffle. $\;$ – user991 Jul 22 '15 at 5:49
• Don't get me wrong, but we're not Google. It's not clear to me what your request for a PRNG recommendation has to do with cryptography... maybe you could edit your question and explain the exact scenario, what you've tried, what you've researched, and what exactly you need help with. For more infos on "how to ask", please take a look at our help center. – e-sushi Jul 22 '15 at 6:00
• @David No, it is entirely possible to do for 64 bit values in constant space - see my answer. – Thomas M. DuBuisson Jul 22 '15 at 16:20