Generating Random numbers to conform a distribution

Rick Harrison harrison at all-auctions.com
Wed Jun 8 00:46:33 EDT 2022


Try rolling 2 six-sided dice.  7 is the number that appears the most
so it’s at the middle of the curve, while 2 and 12 are at the ends
of the distribution.  Roll the dice multiple times to generate a
distribution.

Now simulate rolling the dice with random numbers in LC the same way.

Now conduct your own experiments, and graph your results.

Have fun!

Rick



> On Jun 7, 2022, at 4:51 PM, David V Glasgow via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> 
> Quite a lot of stats and maths packages offer a feature whereby the N, the Mean and the SD are variables specified by the user, and N random numbers are then generated with the required mean and SD.  I remember the venerable and excellent Hypercard  HyperStat <https://link.springer.com/content/pdf/10.3758/BF03204668.pdf> (1993) by David M Lane doing exactly that.
> 
> In general terms, how do they do this?  One option would be to ‘pair’ each random number with its reciprocal around the mean, but that would generate perfectly symmetrical distributions, not to mention is only half random.
> 
> Alternatively you could ‘aim’ at the sum and do a little series of kludges at the end of the RND generation.  Ugly and cheaty, and neither addresses the SD challenge
> 
> Or is there an elegant formula?  I have Googled about and can’t see one, but maybe I don’t know the magic words.  And if someone wanted to script this in LC what would be the best approach? (just general guidance here, wouldn’t want anyone to invest their valuable time in what is at present just vague musings)
> 
> Any hints from the stats gurus?
> 
> Cheers
> 
> David Glasgow
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list