SQL*Plus random function
From: Michael Joseph <qmick_at_pipeline.com>
Date: 1 Feb 1995 19:46:50 -0500
Message-ID: <3gpa1q$q4n_at_pipe4.pipeline.com>
Date: 1 Feb 1995 19:46:50 -0500
Message-ID: <3gpa1q$q4n_at_pipe4.pipeline.com>
Try this function which assumes that you can find the functions shown below in SQL.
This function comes from a CLIPPER programmer.
FUNCTION NB_RND()
LOCAL nA, nB, nC, nD
STATIC nClock := 0
STATIC nSeed := 0
IF nClock == 0
nClock := nSeed := Seconds()
ENDIF
IF nClock == Seconds()
nSeed := nSeed * Pi/Epsilon
ELSE
nClock := nSeed := Seconds()
ENDIF
IF nSeed == 0 //When the clock strikes midnight, nSeed := Pi + Epsilon //the mouse takes another byte.ENDIF
nA := (nSeed * 100) / (Pi - Int(Pi) + Epsilon - Int(Epsilon)) nB := (nA - Int(nA)) / nSeed nC := nB + 1 / If(nB == 0, Pi + Epsilon, nB) nD := Exp(nB + Log(nC)) - Int(Exp(nB + Log(nC)))
RETURN nD Received on Thu Feb 02 1995 - 01:46:50 CET