KiXtart Language Reference (Rnd)
Windows Command Lines
Other Command Line Utilities
Available from version 3.51 through the latest release.
Rnd ([<maximum value>])
Returns a pseudo-random number
The following example uses a random number between zero and ten to Sleep, if the file to be written to is determined to be in use. If several clients are trying to write to the same file at the same time, this method helps to stagger the periods they wait to try again.
SRnd ( @MSECS )
$OpenCheck = Open(1,"c:\temp\common_log.txt",5)
If $OpenCheck = 32
$WaitCount = Rnd(10)
? "File In Use. Waiting $WaitCount Seconds..."
$ = WriteLine(1, "@WKSTA Reporting in: @DATE @TIME @CRLF")
$ = Close (1)
Pseudorandom means that the random set of numbers returned by the Rnd function will be identical each time this seed value is the same. The seed value for random number generation is set by the SRnd function.
Portions taken from, The Start to Finish Guide to Scripting with KiXtart. Used by permission.
Have a correction, addition or suggestion on this? Please let us know!
Last Edited: 6/1/2004. This page has been viewed 3357 times. Unless otherwise specified, all information is (C) 2004-2007 iTripoli, Inc. All Rights Reserved.
Abs CDbl Cint Val CStr Round Int Fix SRnd DecToHex FormatNumber ASC
Note: you can view this information right within ASE by right clicking any keyword and selecting "Help..."
Now In Print! 496 Pages of detail covering each and every command. Includes common problems, command alternatives and real-world examples throughout.
Click here for special 35% discount!