bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: $RANDOM is never equal to the next $RANDOM


From: Chet Ramey
Subject: Re: $RANDOM is never equal to the next $RANDOM
Date: Mon, 07 Mar 2005 09:39:11 -0500
User-agent: Mozilla Thunderbird 1.0 (Macintosh/20041206)

zavandi wrote:
Chet Ramey <chet@caleb.ins.cwru.edu> wrote:

Why would you expect $RANDOM to return the same value twice in succession?


I don't expect it to always return the same value twice in succession,
but if the values are independent of one another, there is a 1/32768
probability the second value will be equal to the first (or I'm
missing something?).

Mathematically that's correct, but since having $RANDOM return the same
value twice in a row would greatly diminish its practical use, there is
special code in there to prevent it.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                                Live...Laugh...Love
Chet Ramey, ITS, CWRU    chet@case.edu    http://tiswww.tis.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]