My favorites | Sign in
Project Home Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 156: Math.random() can return 1
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Feb 2012


 
Reported by tyn...@gmail.com, Jan 22, 2012
Snippet to reproduce the issue:
for(i in 1...100000) {
    if(Math.random() == 1) {
        trace("Math.random() returned 1, and that should be impossible.");
    }
}

Obviously, this occurs randomly, but usually there's 2 to 6 '1' rolled on 100'000 rolls. It is inconsistant with the standard Haxe (and Flash) Math.random.
Feb 8, 2012
Project Member #1 gameh...@gmail.com
That one could have been a bad bug - well spotted.  I misunderstood 'RAND_MAX'. 
Should be fixed now.

Status: Fixed

Powered by Google Project Hosting