<-- Previous || Up || Next -->

Random Long Arg Function
Random Values Class

Public Function RandomLongArg( _
    ByVal vAnything As Variant _
    ) As Variant

"Random Long With Argument"
Generates a random Long (integer) number whose value is between MaxInteger + 1 and MaxLong - 1 inclusive.
Forces the Microsoft Access Query optimizer to execute this function call for each row of the SQL UPDATE statement in which it is normally used; see below.

    Rnd(-1) = 0.224007
    RandomLongArg(1) = 352781522
    RandomLongArg(2) = 1096661399
    RandomLongArg(3) = 1439299645
    RandomLongArg("Alpha") = 193695195
    RandomLongArg("Bravo") = 1951273186
Note: The call to the Visual Basic Rnd function in the above example seeds the Visual Basic random number generator so that the sample results can be reproduced. There is generally no need to call the Rnd function within your programs since Entisoft Tools initializes the Visual Basic random number generator once with "Randomize" statement.
See also:
    RandomLongArgRV Function (In file ESTINAC2.TXT, et. al.)
    RandomLongWithinRange Function
    NowUnique Function
    SequenceLong Function
vAnything: The value of one or more columns within the Access Query. For each unique value of the expression passed via vAnything, Microsoft Access will call this function once to generate a unique random Long number. If one or more Query rows have the same value for vAnything, Microsoft Access will use the previous result that was calculated by calling the function with the same argument. (There is no way to tell Microsoft Access that a function is "volatile" and to cause it to evaluate the function once for each row within the Query.)
Note: This function is mostly obsolete now that Microsoft Access for Windows 95 has a data type which generates random primary key values.
    RandomLongWithinRange(MaxInteger + 1, MaxLong - 1)

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.