vendredi 19 juin 2015

Random number in different langauge

I have two codes which have the same algorithm but implemented in different programming languages, MATLAB and JavaScript. In my implementation, I use betarnd, rand and randn in MATLAB and use jStat.beta.sample, jStat.uniform.sample and jStat.rand to generate random number in both codes (each jStat random function has conforming to definition of each MATLAB function).

JavaScript:

yxt = 1000 + parseFloat(jStat.rand(1)); 

MATLAB:

yxt = 1000 + randn;

I found the results of the same algorithm with such random number are quite different. So I wonder that is it possible getting random numbers in various stochasticity in different programming languages?




Aucun commentaire:

Enregistrer un commentaire