Mailing List ArchiveSupport open source code!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: tlug: Get your Bumpers ready!
- To: tlug@example.com
- Subject: Re: tlug: Get your Bumpers ready!
- From: "Stephen J. Turnbull" <turnbull@example.com>
- Date: Thu, 20 Nov 1997 12:59:18 +0900 (JST)
- Content-Transfer-Encoding: 7bit
- Content-Type: text/plain; charset=us-ascii
- In-Reply-To: <34714A4A.8D03B4A4@example.com>
- References: <Pine.LNX.3.96.971117182348.3200B-100000@example.com><34714A4A.8D03B4A4@example.com>
- Reply-To: tlug@example.com
- Sender: owner-tlug@example.com
>>>>> "Alan" == Alan B Stone <stoneab@example.com> writes: Alan> I will say this since working with random numbers/generation Alan> is something I work with. If you place a range (limit) like Alan> from this to that, then excluding fractions and decimals you What does this mean in the context of finite precision floats? Most fractions and decimals are not representable. In fact, none of the relevant ones are in the case of most pseudo-random number generators since MaxRand is normally relatively prime to the base for the FP representation. Alan> do not have a random number generator. Ah.... Knuth suggests "this +(floor(((that-this)*rand())/MaxRand))"; do you know something he didn't know in 1981? It is not quite uniform, but if (that - this) isn't too big, nobody in TLUG will notice. And AFAICT, if MaxRand == a*(that - this) + b, then int draw () { int temp = rand() - b; /* assume MaxRand < MaxInt */ return temp < 0 ? draw() : this + temp % a; } ought to do the trick. If it doesn't, rand() is unsatisfactory for Monte Carlo studies in any case. Statisticians do exactly that kind of conditioning operation on pseudo-random variables all the time in constructing tables for statistics whose distributions cannot be solved in closed form. And it is an algorithm (despite looking like a potential infinite recursion), since pseudo-random numbers must cycle, and "good" ones are usually required to hit all values. Could be a mite slow on really bad choices of seed, but running time is bounded.... >>>>> "Craig" == Craig Oda <craig@example.com> writes: Craig> for the salt, the system clock? When I did it with Java, I Craig> was getting random numbers clustered in certain areas. (I I really don't think so ... Sun isn't that dumb. Anyway, for many versions of libc all the random number generators were in fact variations on a theme. Even if not, I'm sure that both Java and Perl use a system-provided function at some level; "rolling your own" general-purpose random number generator is a very very dangerous thing to do. Knuth devotes 170 (one hundred and seventy) pages of _The Art of Computer Programming_ to the topic. 170 very very dense pages.... Craig> Ahh, to use hitech or lotech that is the question. Which Craig> is more random? Ask Schroedinger's Cat. --------------------------------------------------------------- TLUG Meeting Dec. 13, 12:30 at Tokyo station Yaesu Chuo ticket gate 13:30 Starbuck's coffee. 13:45 HSBC | info: joem@example.com At least 3 functional Sparc IPC machines will be raffled out --------------------------------------------------------------- a word from the sponsor: TWICS - Japan's First Public-Access Internet System www.twics.com info@example.com Tel:03-3351-5977 Fax:03-3353-6096
- References:
- Re: tlug: Get your Bumpers ready!
- From: Craig Oda <craig@example.com>
- Re: tlug: Get your Bumpers ready!
- From: "Alan B. Stone" <stoneab@example.com>
Home | Main Index | Thread Index
- Prev by Date: RE: Re: tlug: Stickers
- Next by Date: tlug: Keeping the spool
- Prev by thread: Re: tlug: Get your Bumpers ready!
- Next by thread: Re: tlug: Get your Bumpers ready!
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links