Math.random
Math.random
Function
Random number. Returns a random floating point number in the range 0 <= n < 1.
Syntax
Math.random()
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| None | - | No | None | No arguments required. |
Return value
| Type | Description |
|---|---|
| Float | Returns a random floating point number 0 <= n < 1. |
Example
result = Math.random() // Output: true print result >= 0 && result < 1
Notes
- Random numbers are not cryptographically secure random numbers.