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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.36.182.76 with SMTP id d12mr729128itj.11.1517887052613; Mon, 05 Feb 2018 19:17:32 -0800 (PST) X-Received: by 10.157.87.93 with SMTP id x29mr42054oti.8.1517887052407; Mon, 05 Feb 2018 19:17:32 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!o66no717506ita.0!news-out.google.com!k194ni7087itb.0!nntp.google.com!w142no1972060ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 5 Feb 2018 19:17:32 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2601:191:8303:2100:7466:f44c:da21:40b1; posting-account=fdRd8woAAADTIlxCu9FgvDrUK4wPzvy3 NNTP-Posting-Host: 2601:191:8303:2100:7466:f44c:da21:40b1 References: <87y3ki743m.fsf@jacob-sparre.dk> <40142b86-fdcf-49d3-bee7-2fdbb04c6db0@googlegroups.com> <8c806572-009d-4ba2-a20d-de1209e45ca6@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <76823ce5-b5c9-485a-bcde-9a59d8ae098d@googlegroups.com> Subject: Re: Card game deck but with trumps suit for tarot "divination" Is there a better way than enumerating all cards? From: Robert Eachus Injection-Date: Tue, 06 Feb 2018 03:17:32 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Body-CRC: 264464841 X-Received-Bytes: 4117 Xref: reader02.eternal-september.org comp.lang.ada:50313 Date: 2018-02-05T19:17:32-08:00 List-Id: On Monday, February 5, 2018 at 7:39:15 PM UTC-5, Randy Brukardt wrote: > "Robert Eachus" wrote in message=20 > news:d6f57d39-fede-4e6e-b0a1-a721a1379643@googlegroups.com... > =20 > The definition of the Ada Discrete_Random generators is to give a uniform= =20 > distribution for the given range. It also guarantees that all values will= =20 > occur (eventually). It's very easy to get this wrong, so there is a stron= g=20 > benefit to using a predefined version that is much more likely to be=20 > correct. >=20 > (I've written a number of incorrect discrete random generators over the= =20 > years, which I guess demonstrates that effect.) >=20 > For the vast majority of usages, the standard generator will be good enou= gh.=20 > In all of the cases I've seen, it's built on top of Float_Random, so wil= l=20 > have similar characteristics. Certainly, it is good enough to handle a fe= w=20 > million deals (you want distinct results from those, you're not worried= =20 > about generating all possible deals). >=20 > If someone has really exacting requirements, they'll have to build your o= wn=20 > random generator, so you can control the characteristics. But this sort = of=20 > thing is for experts only. (Janus/Ada uses the generator provided by Ken= =20 > Dritz during the Ada 9x work; he didn't provide an implementation of=20 > Discrete_Random, and I proved the point by getting that wrong. ;-) 1) I'm sorry if you got the impression that I am not an expert in this fiel= d. ;-) 2) It is unfortunate that most PRNGs convert a discrete (integer or modular= ) generator into a floating point value and rub off the serial number in th= e process. Insisting on a 64-bit float will help prevent some precision lo= ss (precision, not accuracy). The other issue is finding a good seed that = is well distributed throughout the values. Usually on Unix/Linux systems t= he "built-in" random number generator should be part of your seed. (But on= ly after you get far enough into debugging. It helps to have the same star= ting seed in debugging runs to see what isn't working.) 3) If I can ask for a couple (non-uniform) RNGs in Ada 2020. I'll ask for = Gaussian (Normal) and discrete and continuous Poisson. Perhaps better is t= o provide a pair of packages that provides generators for most useful distr= ibutions.