
We must make sure that if folk use Rnd2WC.inc then Rnd2TidyUp is required whether Case 7 is used or not.
We may finally have arrived at grandma's house.


Suppose we have an application which uses random numbers but insists on using sequences that have never seen the light of day before.
Enter two new macros ...
Code:
Macro Rnd2SaveSeq = Rnd2(9) ' Save current sequence Macro Rnd2LoadSeq = Rnd2(10) ' Load saved sequence
Code:
Case 9 Open "Rand.dat" For Binary As #1 Put$ #1, StoreState Close #1 Case 10 Open "Rand.dat" For Binary As #1 Get$ #1, 60, StoreState Close #1
Code:
Rnd2SetUp ' If Rnd2WC.inc [b]and[/b] Case 7 are being used If IsFile("Rand.dat") = %False Then Rnd2SaveSeq End If Rnd2LoadSeq ' Do some work '----------------------------------- pStr = "" For i = 1 To 20 pStr = pStr + Str$(Rnd2()) + $CrLf Next MsgBox pStr '----------------------------------- Rnd2SaveSeq Rnd2TidyUp ' If Rnd2wC.inc is being used
I'm still kicking this around.
Perhaps we should forget about anything new and put this on the back burner for 'Rnd2 revisited again'.

Leave a comment: