Re: RandomNumberGenerator
Posted by Luigi Ballabio-2 on Jun 08, 2004; 3:11am
URL: http://quantlib.414.s1.nabble.com/RandomNumberGenerator-tp2978p2984.html
On 2004.06.08 03:36, John Kiff wrote:
> I was just looking for a better RAND(). I thought that
> RandomNumberGenerator() was just that, but I'm thrown by the
> need for specifying not only a seed, but also an RNGType, "dimension"
> and "samples". I figure that "RNGType", which appears to be numeric
> value, corresponds to some numbering scheme that specifies
> a particular generator (e.g., Mersenne Twister) but I can't find the
> legend. However, if my need is to produce a single random number
> [0,1] I can't figure out where "dimension" and "samples" comes in.
John,
I'm not familiar with QuantLibXL at all, but as Obi-Wan used to
say, "use the source, Luke." It appears that in true spreadsheet
tradition, RandomNumberGenerator and its Gaussian counterpart were
meant to be jacks of all trades. They can use either a pseudo-random
(RNGType = 1) or a low-discrepancy (RNGType = 2) generator. The
"dimension" parameter is used to return either a single number or a
random vector of a given dimension (because for low-discrepancy
generators, it does matter whether you want a single multi-dimensional
sample in R^N or N consecutive samples in R.) Finally, the function
kindly offers to return M samples in one single call--be they numbers
or vectors. To summarize, if you want a single number at every call,
you can put dimension = samples = 1.
I'll purposely refrain from commenting on the idea of "generality"
meant as "cram as much parameters as you can" :)
Hope this helps,
Luigi