From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a10fc2d4d530dd05 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!news3.google.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!.POSTED!not-for-mail From: "John B. Matthews" Newsgroups: comp.lang.ada Subject: Re: Random number generation Date: Wed, 14 Jul 2010 00:42:39 -0400 Organization: The Wasteland Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 14 Jul 2010 04:42:39 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="XHGR0soRZbMj+IDq9rKW3w"; logging-data="32406"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+l/7nGUhAJaoRWKBf8LfODgFuXeF+Uyxs=" User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Cancel-Lock: sha1:dIUk9NnpmqJ2sQdKO6tgf3mb7SE= Xref: g2news1.google.com comp.lang.ada:12410 Date: 2010-07-14T00:42:39-04:00 List-Id: In article , "Jeffrey R. Carter" wrote: > On 07/13/2010 01:33 PM, John B. Matthews wrote: > > > > The shuffling algorithm needs work; this might be an alternative: > > > > > > The problem with this (for Ada) is the need to instantiate > Discrete_Random for a different range each time (although you could > use PragmARC.Universal_Random.Random_Int). Thank you for suggesting this; I see the problem, now. Section A.5.2(50), Note 16, mentions the very problem, suggesting Float_Random as an alternative: I also found this implementation using Discrete_Random: > If it's for a game with a human, then the biased version of using the > full range each time is good enough. No, it's a simulation; I don't get off that easy. > > As an aside, Mine Detector V6.0 builds on Mac OS X 10.5.8 with GtkAda > > 2.14.1 and GNAT 4.3.4. Wait, I took a picture: > > > > > > Cool. I wouldn't check any boxes with only 100 mines. They were smiling for the camera! :-) -- John B. Matthews trashgod at gmail dot com