-
Math.random newbie question
I am in a beginning javascript class. I understand this is a total newbie question and I appologize in advance.
My textbook states that Math.random will generate a random number between 0 and 1. Does this INCLUDE 0 and 1? I am getting a feeling from my results that it does.
Thank you for your time and responses,
Robin
Last edited by buymysoul; 07-15-2005 at 02:25 PM.
Reason: change title
-
I don't know about javascript.
There are many javascript tutorials or help sites on the web, including w3schools.com.
Java's Math.random() method will generate random numbers "greater than or equal to 0.0 and less than 1.0" (per the API documentation).
My guess is that javascript handles the random function in the same way.
Last edited by nspils; 07-15-2005 at 08:08 PM.
-
According to O'Reilly "JavaScript - The Definitive Guide" Math.random() returns
A pseudo-random number between 0.0 and 1.0
eschew obfuscation
-
Hey thanks guys, I guess the anomolie I experienced had to do with something else.
Thanks a lot for your help.
Robin
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks