Re: [Rd] Problem with R math library.

From: Dirk Eddelbuettel <edd_at_debian.org>
Date: Thu, 28 Jan 2010 06:32:08 -0600

Salut Guilluame,

On 28 January 2010 at 12:38, Guillaume Yziquel wrote:
| Hello.
|
| I've been working on my OCaml-R binding, and I quite pleased to see that
| it is functional, though far from being perfect or polished. You can
| find the gitweb webpage and the interface documentation at
|
| http://yziquel.homelinux.org/gitweb/?p=ocaml-r.git;a=tree
| http://yziquel.homelinux.org/topos/api/ocaml-r/index.html
|
| I'm having unexpected trouble with the math library, though. The
| interface documentation is here:
|
| http://yziquel.homelinux.org/topos/api/ocaml-r/Rmath.html
|
| For instance, for the norm_rand symbol, I have the following
| documentation comment:
|
| > val norm_rand : unit -> float
| > Random variates from the standard normal distribution. Bug: currently systematically returns -8.77332116900134373.
|
| Any idea as to why the function systematically returns the same value?
| Is there a way the math library should be initialised?

I think it is pretty clearly documented in R-exts:

  6.3 Random number generation


  

  The interface to R's internal random number generation routines is   

       double unif_rand();
       double norm_rand();
       double exp_rand();
  

  giving one uniform, normal or exponential pseudo-random variate.   However, before these are used, the user must call   

       GetRNGstate();   

  and after all the required variates have been generated, call   

       PutRNGstate();   

  These essentially read in (or create) `.Random.seed' and write it out   after use.

Dirk

|
| All the best,
|
| --
| Guillaume Yziquel
| http://yziquel.homelinux.org/
|
| ______________________________________________
| R-devel_at_r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Three out of two people have difficulties with fractions.

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Thu 28 Jan 2010 - 12:35:10 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 28 Jan 2010 - 13:40:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive