Prev: pointer and allocatable arrays
Next: f95 to windows dll
From: Gib Bogle on 20 Nov 2009 22:43 Ron Shepard wrote: > In article <7meelsF3g7qejU1(a)mid.individual.net>, > frank <frank(a)example.invalid> wrote: > >> Isn't there an asymmetry in the unit interval though as to which endpoint >> is included? So if there's N outcomes on one side of .5 there would be N >> +-1 on the other. > > There are more floating point values between 0 and .5 than there are > between .5 and 1. It is not just a difference of +-1 value. Should all > such values occur in the pseudorandom sequence, or only a subset of such > values? > > $.02 -Ron Shepard How many more?
From: Gib Bogle on 20 Nov 2009 22:46 nmm1(a)cam.ac.uk wrote: > In article <%ShNm.55991$ze1.49888(a)news-server.bigpond.net.au>, > robin <robin_v(a)bigpond.com> wrote: >> "David Flower" <DavJFlower(a)AOL.COM> wrote in message >> news:8b69b09f-fd08-44a2-a48b-03afab751b88(a)z41g2000yqz.googlegroups.com... >> >>> Posters may be interested in the following reference: >>> A.C.M. Trans. Math, Software, 5, #2, 132 (1979) by Linus Schrage >> It's a bit ancient. >> Those by George Marsaglia are not only portable, >> they also have extremely long periods. >> >> His RNGs include 32-bit generators and 64-bit generators. > > 32-bit generators should never be used in any simulation which > uses more than a million numbers in total. Never say never. There are many (probably most, in fact) applications where it will make absolutely no significant difference to the results if the RNG repeats the cycle.
From: Ron Shepard on 21 Nov 2009 02:28 In article <he7nm8$qnt$2(a)lust.ihug.co.nz>, Gib Bogle <bogle(a)ihug.too.much.spam.co.nz> wrote: > Ron Shepard wrote: > > In article <7meelsF3g7qejU1(a)mid.individual.net>, > > frank <frank(a)example.invalid> wrote: > > > >> Isn't there an asymmetry in the unit interval though as to which endpoint > >> is included? So if there's N outcomes on one side of .5 there would be N > >> +-1 on the other. > > > > There are more floating point values between 0 and .5 than there are > > between .5 and 1. It is not just a difference of +-1 value. Should all > > such values occur in the pseudorandom sequence, or only a subset of such > > values? > > > > $.02 -Ron Shepard > > How many more? About half of the exponent range. In binary floating point, are the same number of (equally spaced) values between .25 and .50 as there are between .50 and 1.0. Then there are that same number of values between .125 and .25, and that same number of values again between .0625 and .125, and so on, all the way down to the minimum exponent value. In most formats, there are about the same number of exponents less than zero as there are greater than zero, so about half of the exponent range corresponds to floating point values that are between 0 and .5, and only a single exponent value corresponds to the floating point values between .5 and 1. For a given exponent, should a PRNG return all of the associated floating point values with equal probability, or only some of them? $.02 -Ron Shepard
From: nmm1 on 21 Nov 2009 03:12 In article <he7nra$qnt$3(a)lust.ihug.co.nz>, Gib Bogle <bogle(a)ihug.too.much.spam.co.nz> wrote: >> >> 32-bit generators should never be used in any simulation which >> uses more than a million numbers in total. > >Never say never. There are many (probably most, in fact) applications >where it will make absolutely no significant difference to the results >if the RNG repeats the cycle. Eh? Why does that contradict my statement? If you can produce an example which uses more than a million numbers and where an almost arbitrarily grotty generator will definitely not give misleading results, I should be interested to hear of it. Yes, there are a zillion applications where the results are nonsense anyway, a zillion others which use only a few random numbers, and so on. But those are out of order. Regards, Nick Maclaren.
From: robin on 21 Nov 2009 17:24
"Ron Shepard" <ron-shepard(a)NOSPAM.comcast.net> wrote in message news:ron-shepard-C17E22.01284221112009(a)forte.easynews.com... | In binary floating point, are the same number of (equally spaced) | values between .25 and .50 as there are between .50 and 1.0. Then | there are that same number of values between .125 and .25, and that | same number of values again between .0625 and .125, and so on, all | the way down to the minimum exponent value. In most formats, there | are about the same number of exponents less than zero as there are | greater than zero, so about half of the exponent range corresponds | to floating point values that are between 0 and .5, and only a | single exponent value corresponds to the floating point values | between .5 and 1. | | For a given exponent, should a PRNG return all of the associated | floating point values with equal probability, or only some of them? Probably a case for integer RNGs. |