Generating Random numbers to conform a distribution

David V Glasgow dvglasgow at gmail.com
Tue Jun 7 16:51:12 EDT 2022


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




More information about the use-livecode mailing list