public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* rng question
@ 2005-12-07 10:25 Jari Häkkinen
  2005-12-07 20:07 ` Brian Gough
  0 siblings, 1 reply; 11+ messages in thread
From: Jari Häkkinen @ 2005-12-07 10:25 UTC (permalink / raw)
  To: gsl-discuss

Hi all,

I have question about the random number generator features and 
documentation.

According to the documentation gsl_rng_max(rng_ returns the maximum 
random number the underlying rng can give, and 
gsl_rng_uniform_int(rng,gsl_rng_max(rng)) will return 
[0,gsl_rng_max(rng)-1]. This will not give the maximum number from the 
underlying generator, so I tried 
gsl_rng_uniform_int(rng,gsl_rng_max(rng)+1) but this call does not 
return (since the second argument becomes 0).

Shouldn't this case be covered by GSL? Either by returning a error code 
or maybe setting the upper bound to gsl_rng_max(rng) when a 0 second 
argumnet is given? At least, I think this case should be covered in the 
documentation.


Cheers,

Jari

^ permalink raw reply	[flat|nested] 11+ messages in thread
* RNG question
@ 2008-08-03 23:32 Robert G. Brown
  2008-08-05  9:05 ` Fabian Bastin
  2008-08-08 11:12 ` Brian Gough
  0 siblings, 2 replies; 11+ messages in thread
From: Robert G. Brown @ 2008-08-03 23:32 UTC (permalink / raw)
  To: GSL Discussion list

I'm preparing to address an rng testing issue in dieharder to fix the
following bug/feature.  dieharder tests all the gsl generators as
embedded tests (making it easy for end users to study all its generators
and assess suitability for various tasks or demonstrate the weaknesses
of the classical weak generators).  It then uses the gsl harness to add
more rngs to test -- it is actually quite easy to wrap any new candidate
rng in the gsl rng format and just add it to the list that can be
invoked to directly test as opposed to test via file input (which is
much more limited).

However, when I add my own gsl rng types with a loop at the end of the
gsl-provided list, they pick up sequential numbers.  This means that if
any new gsl routines are added (as has happened a few times) all the
non-gsl routines have their numbers bumped.  If I add or rearrange any
of my own (since some of them group by type, it makes more sense to keep
them "together" in number-space) this also can change the number of
existing rngs.

I didn't view this as a problem during design, and the default behavior
of dieharder without arguments is to spit out a list of all its known
rngs just so people could see what was what.  HOWEVER, users have
started to make scripts that tests certain rngs, by number, and when the
numbers bump as described above it breaks their scripts.

There are obviously several ways I can fix it so this never happens
again, but I thought before I implemented any of them I'd ask at least
if it is now expected that the rngs in the gsl are "frozen", or if there
is an ongoing possibility that more will be added?  I'm guessing the
latter -- if somebody invents a really great one you can hardly not
include it in the GSL, and I've got a few that I might be able to
contribute back eventually as well, if there is any interest.

The other question I have is that at one point in time the maximum
number of rngs one could have was restricted by a macro in the sources
to be 100 (if I recall correctly -- I have a remark to that effect in my
own code's comments).  One solution to the dilemma above is to create
"ranges" of numbers -- 0-99 for gsl rngs, 100-199 for dieharder added
rngs, 200+ for user added rngs.  This would, however, require that the
macro/variable's value be bumped in the gsl to maybe 500 or 1000.
Otherwise I think it is not impossible that dieharder will exhaust the
current gsl space in the next few years, as people keep contributing new
rngs at a slow but steady pace, and I've got a small stack of them
standing by to add when I next get a chance.

Comments?  Answers?

    rgb

-- 
Robert G. Brown                            Phone(cell): 1-919-280-8443
Duke University Physics Dept, Box 90305
Durham, N.C. 27708-0305
Web: http://www.phy.duke.edu/~rgb
Book of Lilith Website: http://www.phy.duke.edu/~rgb/Lilith/Lilith.php
Lulu Bookstore: http://stores.lulu.com/store.php?fAcctID=877977

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-08-18 21:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-07 10:25 rng question Jari Häkkinen
2005-12-07 20:07 ` Brian Gough
2005-12-09 13:49   ` Jari Häkkinen
2005-12-17 16:50     ` Brian Gough
2005-12-17 23:58       ` Jari Häkkinen
2008-08-03 23:32 RNG question Robert G. Brown
2008-08-05  9:05 ` Fabian Bastin
2008-08-08 11:12 ` Brian Gough
2008-08-08 12:33   ` Robert G. Brown
2008-08-11 20:47     ` Brian Gough
2008-08-18 21:12     ` Robert G. Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).