|
From: | Alasdair McAndrew |
Subject: | Re: Same sequence of random number generators than under Matlab? |
Date: | Tue, 5 Jun 2012 22:08:20 +1000 |
The article you want is at http://www.mathworks.com.au/moler/random.pdfand the LCG (very simple) isx(n+1) = 16807*x(n) mod 2^31-1 with x(1)=1.You can see Moler's m-file here:-AlasdairOn Tue, Jun 5, 2012 at 7:21 PM, Mathieu Dubois <address@hidden> wrote:
----- Mail original -----
De: "Alasdair McAndrew" <address@hidden>
À: "Mathieu Dubois" <address@hidden>, address@hidden
Envoyé: Lundi 4 Juin 2012 14:26:00
Objet: Re: Same sequence of random number generators than under Matlab?
Following your advice, I was trying to implement the LCG but I can't find the document. Could you repost it?
> Writing your own is a good idea. Cleve Moler, here, speaks of the linear congruential generator
> x_{k+1} = ax_k (mod m)
> with a,m = 16807, 2^31-1
Also thanks for the other algorithm but I want to use a simple one.
Mathieu
On Mon, Jun 4, 2012 at 12:03 AM, Mathieu Dubois < address@hidden > wrote:
Hello,
I want to comapre the output of the Self-Organinzin Map algorithm under Matlab and Octave.
The algorithm is stochastic because, as in most training algorithm, the data are presented inrandom order.
In order to compare as precisely as possible the Matlab and Octave version it seems necessary to have the same sequence of random numbers.
Is there a way to do that?
I have tried the following:
rand('twister', 10);
s = rand(10, 1);
disp(s);
disp(mean(s));
disp(var(s));
The sequences are different (but the statistics are close).
Mathieu
______________________________ _________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/ listinfo/help-octave
--
Blog: http://amca01.wordpress.com
Web: http://sites.google.com/site/amca01/
Facebook: http://www.facebook.com/alasdair.mcandrew
--
Blog: http://amca01.wordpress.com
Web: http://sites.google.com/site/amca01/
Facebook: http://www.facebook.com/alasdair.mcandrew
[Prev in Thread] | Current Thread | [Next in Thread] |