Results 1 to 1 of 1
Thread: Randomizing to a historic date
2009-03-17, 08:34 #1
- Join Date
- Feb 2001
- Yilgarn region of Toronto, Ontario
- Thanked 0 Times in 0 Posts
I think this is what I want.
I have a password generator that uses, amongst other things, today's date as a component of the (encrypted) string.
I want to generate a random number, hence "RND()", but I also want to be able to go back in time and re-generate the password as it would have been generated, say, a year ago.
It seems to me that RANDOMIZE-ing to the date and preceding that call by a RND(-1) does the trick.
Comments are welcomed.[pre]Sub Test()
' From Word2000/VBA Help:
' To repeat sequences of random numbers,
' call Rnd with a negative argument immediately before using Randomize with a numeric argument.
' Using Randomize with the same value for number does not repeat the previous sequence.
Randomize (Date) ' In practice, use a date variable, can be from NOW() or from InputBox$