Using Mathematica, I need to define a function of one integer variable that generates the same real number in the range 0 to 1, if it is called with the same argument, but gives a different real number if its argument is changed. For example :
Func[1] = 0.12675,
Func[2] = 0.11213,
Func[2] = 0.11213,
Func[1] = 0.12675,
Func[3] = 0.02561,
and so on.
How can I define such a function?
Edit
A more precise statement of the pseudo-random nature of the function Func
.
The function should generate new numbers for each Mathematica session. So after thousands of sessions, the values Func[1]
are uniformly distributed on the intervall 0 to 1. For a given session, Func[1]
generates the same number again and again. But in the next session, Func[1]
would be a different number. Otherwise, the generated numbers couldn't be considered as "random" if they are always the same.