In alt.msdos.batch.nt message <
4F887C9C...@uwasa.fi>, Fri, 13
Apr
2012 22:21:00, Timo Salmi <
t...@uwasa.fi> posted:
>On 12.04.2012 21:08 Dr J R Stockton wrote:
>> In alt.msdos.batch.nt message <
4F858F12...@uwasa.fi>, Wed, 11 Apr
>> 2012 17:02:58, Timo Salmi <
t...@uwasa.fi> posted:
>>> On 11.04.2012 16:53 Timo Salmi wrote:
>>>> Function RandomFn (low, high) 'VBS
>>>> RandomFn = Int (low + (high - low + 1) * Rnd) 'VBS
>>>> End Function 'VBS
>
>> An underlying generator with fewer than 17 bits cannot possibly, for
>> example, generate a random number in the range 00000-99999; with a
>> 16-bit generator, for example, over a third of the hoped-for values will
>> be missing.
>
>True. But if one is concerned, it is fairly trivial to combine two
>sufficiently short random sequences side by side. Furthermore, the
>quality of the random numbers hardly is essential anyway when one
>resorts to crude methods such as batch programming.
One never knows who else may read advice given publicly and use it
where
more advice is needed; and I did somewhere say "Where it matters".
Sequences being combined must be of independent origin to get any
real
gain; however many calls of %random% are stirred together to generate
a
long random string, the cycle length cannot exceed that of the
internal
state of the %random% engine used. The VBS engine is known, and I
have
emulated it in vb-maths.htm; it is a 24-bit Lehmer engine -
<
http://en.wikipedia.org/wiki/Linear_congruential_generator>
<
http://en.wikipedia.org/wiki/Lehmer_RNG>?
Batch returns 15 bits; but it is easy to show that the generator has
more than that - there was no pattern repeat in more than 2^20
consecutive values. It might well use the same routine as VBScript,
in which case one wouls need to check somewhat over 2^24
consecutive values.
--
(c) John Stockton, near London, UK. Using Google, no spell-check.
Mail: J.R.""""""""@
physics.org or (better) via Home Page at
Web: <
http://www.merlyn.demon.co.uk/>
FAQish topics, acronyms, links, etc.; Date, Pascal, JavaScript, ....|