TerraME / terrame

TerraME is a programming environment for spatial dynamical modelling
www.terrame.org
GNU Lesser General Public License v3.0
36 stars 13 forks source link

parameter 'kind' to Random #773

Open pedro-andrade-inpe opened 9 years ago

pedro-andrade-inpe commented 9 years ago

Add a parameter 'kind' to Random that indicates the random number generator to be used. This will let the user to select the one that fits in with the objective of the model to be implemented. "lcg" (Linear congruential generator), "mwc", (Multiply-with-carry), and "mt" (Mersenne twister) are some of the options. The documentation should describe the advantages and disadvantages of each.

tiagogsc commented 9 years ago

Doesn't make sense to have this parameter and also doesn't have any sense to have several algorithms to generate random number. You just need a very good algorithm which must be proven tp generate uniformly distributed numbers. Then, you may use this generator to implement random numbers in several distributions. Since each distribution have different parameters, the kind argument won't be so useful.

I suggest we use the sintax below for providing random numbers in several distributions. Let rand be a Random object from TerraME

rand:normal(mean, std)

rand:exponential(lambda)

rand:poisson (alfa)

Actually, I have implemented some different distributions for TerraME from the mersene twister algorithm. Please, se the file attached.

Add a parameter 'kind' to Random that indicates the random number generator to be used. This will let the user to select the one that fits in with the objective of the model to be implemented. "lcg" (Linear congruential generator), "mwc", (Multiply-with-carry), and "mt" (Mersenne twister) are some of the options. The documentation should describe the advantages and disadvantages of each.

— Reply to this email directly or view it on GitHub https://github.com/TerraME/terrame/issues/773.

tiagogsc commented 9 years ago

attached

Prof. Dr. Tiago Garcia de Senna Carneiro TerraLAB - Earth System Modelling and Simulation Laboratory Computer Science Department, UFOP - Federal University of Ouro Preto

Campus Universitário Morro do Cruzeiro, Ouro Preto - MG, Brazil, 35400-000 +55 31 3559 1692 +55 31 3559 1253 www.terralab.ufop.br www.decom.ufop.br

2015-11-05 16:59 GMT-02:00 Tiago Garcia de Senna Carneiro < tiagogsc@gmail.com>:

Doesn't make sense to have this parameter and also doesn't have any sense to have several algorithms to generate random number. You just need a very good algorithm which must be proven tp generate uniformly distributed numbers. Then, you may use this generator to implement random numbers in several distributions. Since each distribution have different parameters, the kind argument won't be so useful.

I suggest we use the sintax below for providing random numbers in several distributions. Let rand be a Random object from TerraME

rand:normal(mean, std)

rand:exponential(lambda)

rand:poisson (alfa)

Actually, I have implemented some different distributions for TerraME from the mersene twister algorithm. Please, se the file attached.

Add a parameter 'kind' to Random that indicates the random number generator to be used. This will let the user to select the one that fits in with the objective of the model to be implemented. "lcg" (Linear congruential generator), "mwc", (Multiply-with-carry), and "mt" (Mersenne twister) are some of the options. The documentation should describe the advantages and disadvantages of each.

— Reply to this email directly or view it on GitHub https://github.com/TerraME/terrame/issues/773.

pedro-andrade-inpe commented 9 years ago
  1. Each random number generator has advantages and disadvantages. For example, Mersene twister is very good but it takes more time to generate numbers than others (for example, xorshift). There is no problem in letting the user to select another generator. The common user will never know this, while the advanced user can take advantage of this possibility. Additionally, finding outputs with the same statistical properties for a given model with different random number generators might be a way to strenghten the results.
  2. There is already a separate issue related to random number distributions: #471.
  3. It is not possible to attach source code files in github. You can put it directly into the comment using Markdown syntax.