Random
function Random: Extended;
Example
procedure ScriptEvent(var Value: variant);
begin
Value := Random; // pseudo-random Extended from 0 inclusive to 1 exclusive
end;
Usage
Random advances Velox's shared across the Velox process linear-congruential generator and returns an Extended value in [0,1).
Parameters
Random has no parameters. It can be called without parentheses.
Returns
One of 2^32 possible values formed as the next unsigned 32-bit generator output multiplied by 2^-32. Zero is possible; one is not.
Additional Technical Info
Random returns the next pseudo-random floating-point value from Delphi's process-global generator. The result is greater than or equal to zero and strictly less than one.
This generator is deterministic, shared and non-cryptographic. It is suitable for low-risk sampling/test variation where sequence coupling is acceptable, not for passwords, tokens, identifiers, security decisions or independent concurrent simulations. The example is fictional and source-reviewed only.
Implementation
uPSI_vxCommonNumberregistersvxCommonNumber.Randomdirectly.- The wrapper calls no-argument Delphi
System.Random. - Installed
DefaultRandom32advances globalRandSeedwith the linear-congruential recurrenceseed := seed * $08088405 + 1modulo 2^32. - Delphi converts the unsigned output to floating point and multiplies it by
2^-32.
Random32Proc can theoretically be replaced by host code, but Velox does not replace it in the reviewed source; the installed default above is the effective implementation.
State, sequence and concurrency
- Every call advances the same process-global
RandSeed.Randomizereplaces that state using timing, whileRandomizeSeedassigns an explicit state. - Other scripts/flows in the same Designer, Service or API Service process can change the sequence between two calls.
- The update is not protected by a lock. Concurrent calls can race and sequence behavior should not be treated as reproducible or independently partitioned.
- A process restart begins from RTL initialization state until a reseed occurs.
- The algorithm and 32-bit internal state are unsuitable for cryptographic unpredictability.
Precision and target behaviour
The public return type is Extended, but the scale constant is a Double and the entropy is only 32 bits. Win64 aliases Extended to Double; Win32 may carry the scaled value in wider precision, but that does not create more random states.
Side effects
The only direct side effect is mutation of process-global pseudo-random state. There is no log, database write or operating-system entropy read per call.
Related entries
RandomIntmaps this value to an inclusive rounded Integer range with a biased distribution.Randomizetiming-seeds the shared generator.RandomizeSeedestablishes a repeatable sequence only when no other shared random call intervenes.
External references
Created 2026-07-15