Shuffling Routine

 

The Random Number Generator Schuffling Routine is a Visual Basic application. It produces uniform random numbers on [0,1]. Schuffling Routine is congruential generator suitable for a 32-bit  platform          It is constructed for more efficient use by providing for a sequence of random numbers and the numbers are returned in a single call. 

 

Dim Ran0Y As Double

Dim Ran0V(97) As Double

Function RandShuffle(idum As Integer)

    Dim dum As Double

    Dim j As Integer

    If idum  0 Then

        Randomize (-idum)

        For j = 1 To 97

            dum = Rnd()

        Next

        For j = 1 To 97

            Ran0V(j) = Rnd()

        Next

        Ran0Y = Rnd()

    End If

    Ran0Y = Rnd()

    j = 1 + Int(97 * Ran0Y)

    If (j  97) Or (j  1) Then

        MsgBox "Error"

    End If

    Ran0Y = Ran0V(j)

    RandShuffle = Ran0Y

    Ran0V(j) = Rnd()

End Function