[#4567] Re: What's the biggest Ruby development? — Aleksi Niemel<aleksi.niemela@...>

Dave said:

18 messages 2000/08/23
[#4568] Q's on Marshal — Robert Feldt <feldt@...> 2000/08/23

[#4580] RubyUnit testcase run for different init params? — Robert Feldt <feldt@...> 2000/08/25

[#4584] Re: RubyUnit testcase run for different init params? — Dave Thomas <Dave@...> 2000/08/25

Robert Feldt <feldt@ce.chalmers.se> writes:

[#4623] Re: RubyUnit testcase run for different init params? — Robert Feldt <feldt@...> 2000/08/28

On Sat, 26 Aug 2000, Dave Thomas wrote:

[#4652] Andy and Dave's European Tour 2000 — Dave Thomas <Dave@...>

24 messages 2000/08/30
[#4653] Re: Andy and Dave's European Tour 2000 — matz@... (Yukihiro Matsumoto) 2000/08/30

Hi,

[#4657] Ruby tutorials for newbie — Kevin Liang <kevin@...> 2000/08/30

Hi,

[ruby-talk:4554] Re: RFC: Ruby extension for Random numbers

From: ts <decoux@...>
Date: 2000-08-22 16:55:32 UTC
List: ruby-talk #4554
>>>>> "R" == Robert Feldt <feldt@ce.chalmers.se> writes:

R> So it suffices to add load and dump methods?

 For an user point of view, he don't need to know that it exist #_load,
 #_dump (this is the internal of Math::Random). You can add (if you want) a
method #dump or just say that he can use Marshal#dump if he want to save
the states of the generator.

R> I'm not sure I know exactly what you mean (even though it sounds as
R> though I should!). Can you give short code (well, structure will
R> do) example (for gaussian)? (I had planned to use something like
R> Box-Mueller method for generating gaussian from uniform(0,1))

 Have you looked at GSL ?

  http://sources.redhat.com/gsl/ref/gsl-ref_15.html#SEC207

 You'll see that it exist a library randist, and for example for
 the gaussian, you have :

 ------------------------------------------------------------
Random: double gsl_ran_gaussian (const gsl_rng * r, double sigma) 
   This function returns a Gaussian random number, with mean zero and
   standard deviation sigma. The probability distribution for Gaussian
   random numbers is,   

       for x in the range -\infty to +\infty. Use the transformation z =
       \mu + x on the numbers returned by gsl_ran_gaussian to obtain a
       Gaussian distribution with mean \mu.

Function: double gsl_ran_gaussian_pdf (double x, double sigma) 
  This function computes the probability density p(x) at x for a Gaussian
  distribution with standard deviation sigma, using the formula given
 ----------------------------------------------------------------

 and this is the same for the other distributions, you have a module
 function which return a probabilty density or a random number for this
 distribution. 


Guy Decoux

In This Thread

Prev Next