(j3.2006) RANDOM_SEED(SIZE=K)
Malcolm Cohen
malcolm
Thu Jun 19 01:20:56 EDT 2014
>I suppose it is in the realm of "Doctor, it
>hurts when I do this,"
No.
> but our seed values occupy 128 bytes.
The internal state of the Mersenne Twister (a well-known good-quality PRNG) is
624 32-bit integers.
> I do not regard the overflow
>to be a big issue, because the same problem
>already occurs for STAT= and IOSTAT= values.
But taking the kind from the SIZE variable works in reverse to how you would
want - if you have 64-bit GET/PUT arrays then you only need a small number of
elements so a smaller SIZE variable might suffice, but if you have 8-bit GET/PUT
arrays you are more likely to need a large SIZE variable. This leads one to
think that it would be better to add a KIND= argument and not try to be overly
clever with reinterpreting the kind of the SIZE argument.
I agree with Bill that it is probably not worth the hassle to make this reliable
to use. To catch the "assignment problem" Bill mentioned you cannot use the
known size of the array (since the intrinsic says >=N) you need to do something
like sacrifice additional elements at the beginning of the array so you can
detect that the user e.g. assigned an 8-bit GET to a 64-bit array to do a PUT.
Actually NAG already does this (so we can tell the difference between a "restart
the sequence" and an ill-advised attempt to tell us how to initialise it), but
making it work with 8-bit or 16-bit integers, assuming the SIZE problem got
sorted, would not be much fun. Or indeed particularly useful.
Cheers,
--
................................Malcolm Cohen, Nihon NAG, Tokyo.
More information about the J3
mailing list