KiXtart Language Reference (Rnd)

[ KiXtart  VBScript  Batch  AutoIt  HTA  PowerShell  Windows Command Lines  Other Command Line Utilities  ]


Rnd  (Function)

Available from version 3.51 through the latest release.

Syntax
Rnd ([<maximum value>])

Description
Returns a pseudo-random number

Example
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 )
:OpenFile
$OpenCheck = Open(1,"c:\temp\common_log.txt",5)
If $OpenCheck = 32
     $WaitCount = Rnd(10)
     ? "File In Use. Waiting $WaitCount Seconds..."
     Sleep ($WaitCount)
     Goto OpenFile
EndIf
$ = WriteLine(1, "@WKSTA Reporting in: @DATE @TIME @CRLF")
$ = Close (1)

Remarks
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.

Also see:
Abs  CDbl  Cint  Val  CStr  Round  Int  Fix  SRnd  DecToHex  FormatNumber  ASC  


 
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.

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!



iTripoli prides itself on providing top notch customer service

Find answers or open a ticket to ask directly, when opening a ticket we will suggest relavant articles to help you get answers as quickly and accurately as possible. Visit our support center now!

Please visit our full support center to find answers quickly or submit questions or feedback.