[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-janitors] Re: #218: random not random
From: |
Chicken Trac |
Subject: |
[Chicken-janitors] Re: #218: random not random |
Date: |
Fri, 23 Apr 2010 21:23:02 -0000 |
#218: random not random
----------------------+-----------------------------------------------------
Reporter: zbigniew | Owner:
Type: defect | Status: new
Priority: minor | Milestone: 4.6.0
Component: unknown | Version:
Keywords: |
----------------------+-----------------------------------------------------
Comment(by zbigniew):
However, there's still a worse problem. On Windows and Solaris, rand()
returns a number between 0 and 32767. This means that in N trials of
(random 100000000), you can only ever get 32768 unique numbers.
Furthermore Windows (XP) seems to exhibit the same problem as OS X where
it returns the same initial random number for many seconds, and
furthermore, the returned numbers are sequential!
{{{ 960 960 ... 961 ... 964 964 964 964 964 964 964 965 965 965 ... }}}
Unfortunately to fix this you start getting into OS-specific functions
like rand_s() on Windows (needs XP or higher) and drand48(3) on Solaris.
--
Ticket URL: <http://www.irp.oist.jp/trac/chicken/ticket/218#comment:1>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.