Function Updated 17 Oct 2026
Math.random()
Returns a pseudo-random number from 0 (inclusive) to 1 (exclusive). It is not cryptographically secure — do not use it for passwords, tokens or IDs that must be hard to guess. Use crypto.randomUUID() for a random unique ID.
Parameters
This function takes no parameters.
Returns
A floating-point number between 0 (inclusive) and 1 (exclusive).
Example
Mixed HTML (or any text file) with inline JavaScript between hash signs.
#Math.round(Math.random() * 100)#The template above produces this output:
16