comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Eachus <rieachus@comcast.net>
Subject: Re: Card game deck but with trumps suit for tarot "divination" Is there a better way than enumerating all cards?
Date: Mon, 5 Feb 2018 19:17:32 -0800 (PST)
Date: 2018-02-05T19:17:32-08:00	[thread overview]
Message-ID: <76823ce5-b5c9-485a-bcde-9a59d8ae098d@googlegroups.com> (raw)
In-Reply-To: <p5atfi$dpg$1@franka.jacob-sparre.dk>

On Monday, February 5, 2018 at 7:39:15 PM UTC-5, Randy Brukardt wrote:
> "Robert Eachus" <rieachus@comcast.net> wrote in message 
> news:d6f57d39-fede-4e6e-b0a1-a721a1379643@googlegroups.com...
>  
> The definition of the Ada Discrete_Random generators is to give a uniform 
> distribution for the given range. It also guarantees that all values will 
> occur (eventually). It's very easy to get this wrong, so there is a strong 
> benefit to using a predefined version that is much more likely to be 
> correct.
> 
> (I've written a number of incorrect discrete random generators over the 
> years, which I guess demonstrates that effect.)
> 
> For the vast majority of usages, the standard generator will be good enough. 
> In all of the cases I've seen, it's built on top of  Float_Random, so will 
> have similar characteristics. Certainly, it is good enough to handle a few 
> million deals (you want distinct results from those, you're not worried 
> about generating all possible deals).
> 
> If someone has really exacting requirements, they'll have to build your own 
> random generator, so you can control the characteristics.  But this sort of 
> thing is for experts only.  (Janus/Ada uses the generator provided by Ken 
> Dritz during the Ada 9x work; he didn't provide an implementation of 
> 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 field. ;-)

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 the process.  Insisting on a 64-bit float will help prevent some precision loss (precision, not accuracy).  The other issue is finding a good seed that is well distributed throughout the values.  Usually on Unix/Linux systems the "built-in" random number generator should be part of your seed.  (But only after you get far enough into debugging.  It helps to have the same starting 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 to provide a pair of packages that provides generators for most useful distributions.


  reply	other threads:[~2018-02-06  3:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-28  7:48 Card game deck but with trumps suit for tarot "divination" Is there a better way than enumerating all cards? bozovic.bojan
2018-01-28  8:57 ` Jacob Sparre Andersen
2018-01-28  9:23   ` bozovic.bojan
2018-01-28  9:46     ` Jeffrey R. Carter
2018-01-28 14:17       ` bozovic.bojan
2018-01-28 16:39     ` Dennis Lee Bieber
2018-01-29 23:16     ` Randy Brukardt
2018-01-30  2:30       ` bozovic.bojan
2018-02-02 19:07       ` Robert Eachus
2018-02-02 23:00         ` Dennis Lee Bieber
2018-02-02 23:05         ` Randy Brukardt
2018-02-03  8:17           ` Jeffrey R. Carter
2018-02-03 16:59           ` Robert Eachus
2018-02-06  0:39             ` Randy Brukardt
2018-02-06  3:17               ` Robert Eachus [this message]
2018-02-06  8:30           ` Petter Fryklund
2018-02-07 20:03             ` Card game deck but with trumps suit for tarot "divination" Is there a better way Robert Eachus
2018-02-07 21:10               ` Bojan Bozovic
2018-02-08 23:06                 ` Robert Eachus
2018-01-28 11:01   ` Card game deck but with trumps suit for tarot "divination" Is there a better way than enumerating all cards? gautier_niouzes
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox