Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Randomize – PB Docs 2022 – PowerBuilder Library

Randomize – PB Docs 2022

Randomize

PowerScript function

Description

Initializes the random number generator so that the Rand function
begins a new series of pseudorandom numbers.

Syntax

Argument

Description

n

The starting value (seed) for the random number generator.
When n is 0, PowerBuilder takes the seed from the system clock
and begins a nonrepeatable sequence. A nonzero number generates
a different but repeatable sequence for each seed value. n
cannot exceed 32,767.

Return value

Integer. If n is null, Randomize returns null. The return value is
never used.

Usage

The sequence of numbers generated by repeated calls to the Rand
function is a computer-generated pseudorandom sequence. You can use the
Randomize function to initialize the random number generator with a value
from the system clock, or some other changing value, so that the sequence
is always different. For testing purposes, you can select a specific seed
value, which you can reuse to make the pseudorandom sequence repeatable
each time you run the application.

Include Randomize in the script for the Open event in the
application.

Examples

This statement sets the seed for the random number generator to 0 so
that calls to Rand generate a new sequence each time the script is
run:

This statement sets the seed for the random number generator to 4 so
that calls to Rand repeat a specific sequence each time the random number
generator is initialized:

See also

Rand


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x