Bookshelf Home | Contents | Index | Search | PDF |
Siebel VB Language Reference > Siebel VB Language Reference >
Randomize Statement
This standard VB statement seeds the random number generator.
Syntax
Randomize [number]
Returns
Not applicable
Usage
If no number argument is given, Siebel VB uses the Timer function to initialize the random number generator.
Example
This example generates a random string of characters using the Randomize statement and Rnd function. The second For...Next loop is to slow down processing in the first For...Next loop so that Randomize can be seeded with a new value each time from the Timer function.
Sub Button_Click
Dim x As Integer, y As Integer
Dim str1 As String, str2 As String
Dim letter As String
Dim randomvalue
Dim upper, lower
Dim msgtext
upper = Asc("z")
lower = Asc("a")
newline = Chr(10)
For x = 1 to 26
Randomize
randomvalue = Int(((upper - (lower + 1)) * Rnd) + lower)
letter = Chr(randomvalue)
str1 = str1 & letter
For y = 1 to 1500
Next y
Next x
msgtext = str1
End SubSee Also
Bookshelf Home | Contents | Index | Search | PDF |
Siebel VB Language Reference Published: 18 June 2003 |