ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Windows functions / Miscellaneous WINDEV functions
  • Random pool
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Returns a random number.
Note: To obtain a random number that can be used with cryptographic technologies (recommended for security reasons), use the RandomCryptoInteger function.
Example
// Récupération d'un réel compris entre 0 et 1
ResHasard = Random()
// Récupération d'un entier compris entre 1 et 33
ResHasard = Random(33)
// Récupération d'un entier compris entre 7 et 21
ResHasard = Random(7, 21)
Syntax

Retrieving a random number included between 0 and 1 Hide the details

<Result> = Random()
<Result>: Real
Random number included between 0 and 1.

Retrieving a random number included between 1 and a value Hide the details

<Result> = Random(<Upper bound>)
<Result>: entier
Random number included between 1 and a specified value (inclusive).
<Upper bound>: entier
Upper bound of the number returned (value included between 1 and 2 147 483 647).

Retrieving a random number included between two values Hide the details

<Result> = Random(<Lower bound> , <Upper bound>)
<Result>: entier
Random number included between two specified values (inclusive).
<Lower bound>: entier
Lower bound of the number returned (value included between 0 and 2 147 483 647).
<Upper bound>: entier
Upper bound of returned number (value included between 0 and 2 147 483 647).
Remarks

Random pool

The "pool" from which the random number is "chosen" can be initialized by InitRandom.
If InitRandom is not called, the random values generated by Random will be the same for each program execution.
WEBDEV - Browser code The InitRandom function is not available as it is useless: the random values generated by the Random FUNCTION will be different each time the program is run.
Business / UI classification: Neutral code
Component: wd300std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/28/2025

Send a report | Local help