Name

Math.random( ) — return a pseudorandom number

Availability

JavaScript 1.1; JScript 1.0; ECMAScript v1

Synopsis

Math.random( )

Returns

A pseudorandom number between 0.0 and 1.0.

Get JavaScript: The Definitive Guide, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.