-
Notifications
You must be signed in to change notification settings - Fork 0
random
ffredyk edited this page Jul 23, 2026
·
1 revision
Random
Unary — random <max>.
random <number>
Returns a random floating-point number in the range [0, max). The value is >= 0 and < max. Uses a thread-safe random number generator (internal lock). Auto-unwraps shared values.
Uses a shared System.Random instance with internal locking for thread safety. Generates a double in [0.0, max). The lock ensures correct behavior under concurrent access but may be a contention point under heavy multi-threaded use.
_dice = random 6; // 0.0 to 5.999...
_roll = floor random 6; // integer 0 to 5
_roll = floor random 6 + 1; // integer 1 to 6// Random between min and max
_randInRange = _min + random (_max - _min);if (random 100 < 30) then { // 30% chance
spawnRareLoot();
};_x = _baseX + random _width;
_y = _baseY + random _height;_angle = random 360;
_rad = _angle * 3.14159265 / 180;Thread-safe — internal lock protects the RNG state. Safe to call from any scheduler concurrently. Note: lock contention may occur under extreme multi-threaded load.
- selectRandom — random element from array
- selectRandomWeighted — weighted random pick
- floor — convert to integer
- Getting Started
- Language Guide
- Type System
- Control Flow
- Functions & Code
- Strings & Text
- Arrays & Collections
- Concurrency
- Promise System
- Thread Safety
- Host API & Embedding
- CLI Tool
- Bytecode Reference
- Multiplayer
- Syntax Sugar
- Optimization Guide
- Benchmarks
- count
- select
- pushBack
- append
- deleteAt
- deleteRange
- resize
- reverse
- sort
- find
- in
- forEach
- freeze
- thaw
- isFrozen
- currentScheduler
- clientOwner
- allSchedulers
- schedulerName
- schedulerExists
- schedulerBudget
- setSchedulerBudget
- fiberCount
- readyFiberCount
- waitingFiberCount
- schedulerLoad
- sendTo