help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] initializing RNG with an array?


From: Peter Johansson
Subject: Re: [Help-gsl] initializing RNG with an array?
Date: Wed, 06 Aug 2014 10:27:18 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0

On 08/06/2014 02:08 AM, Anye Li wrote:
Hi,

Does anybody know of a way to seed the random number generator with an
array of data, so that the number of sequences available is limited by
the size of the state rather than the range of the RNG?  I see
gsl_rng_memcpy and gsl_rng_fread in the documentation but it seems these
are for restoring a known good state, not for seeding with unknown data.
I'm looking for something along the lines of MT19937's init_by_array.


I'm curious what your use case is when this is an actual limitation. FWIW, I reckon it's against the idea with gsl_rng as it was design to be polymorphic so one can easily replace one generator with another.

Anyway, AFAICS, you can seed set the state with something like

void set_state(gsl_rng* r, void* seed, size_t size)
{
    memcpy(r->state, seed, size);
}

cheers,

--
Peter Johansson




reply via email to

[Prev in Thread] Current Thread [Next in Thread]