'
' MRG.GetNext
'
' Initialize a multiple recursive RNG.
'
' SELF:
' llMRG: Object created by MRG.Create
'
' Returns: Number in range 0..2^31-1
'
' Requires: Point.Add, Point.Multiply, Number.AsPoint, Point.AsNumber
'
' ArcView 3.2a
' 4 Jan 2002, WAH @QD
' (c) 2002 Quantitative Decisions
' All rights reserved.
'
' See http://crypto.mat.sbg.ac.at/results/karl/server/node7.html
'======================================================================'
llMRG = SELF
lPtA = llMRG.Get(0) ' Coefficients
lPtX = llMRG.Get(1) ' Last values
'
' Compute the inner product.
'
ptN = 0@0
for each i in 0..(lPtA.Count-1)
ptA = lPtA.Get(i)
if (ptA<>(0@0)) then
ptN = ptN+av.Run("Point.Multiply",{ptA,lPtX.Get(i)})
end
end
n = av.Run("Point.AsNumber",ptN)
ptN = av.Run("Number.AsPoint",n)
'
' Shift.
'
lPtX.Insert(ptN)
lPtX.Remove(lPtX.Count-1)
return n
' end of script