On Sun, 27 Nov 2011, Carlos Andrade wrote:

> Gretl List
> How to generate a random variable for a given range of values?
> Example: 46 observations between 0 and 45.

There are several ways, but the main difference is: with repetiton or not? 
Have a look at this:

<hansl>
nulldata 46

#with repetition
series x = floor(uniform(0,46))

#without repetition
matrix tmp = muniform(46,1) ~ seq(0,45)'
series z = msortby(tmp,1)[,2]
</hansl>

Hope this helps,


Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche

r.lucchetti(a)univpm.it
http://www.econ.univpm.it/lucchetti

Reply via email to