Page 1 of 1

random arrays in a table

Posted: Sat Nov 17, 2018 11:48 pm
by Mo216
Hello everyone,
I know how to generate random data but I want to have a table which for each array I could have random values. and what what is the loop command to generate new values each iteration?
I really appreciate if you can help me with it.

Re: random arrays in a table

Posted: Sun Nov 18, 2018 10:33 am
by Renger
Hi
Here is a small example with uniformly distributed random date

Code: Select all

set i /r1*r3/, j /c1*c3/, iter /1*3/;

parameter
    randval(i,j) Random values,
    randvalloop(iter, i,j) Store the random values;


* Set uniform random values between 1 and 10
* and set the seed so we can reproduce the results
$set seed 123456
loop(iter,
    randval(i, j) = uniform(1,10);
    randvalloop(Iter, i,j) = randval(i,j);
    );

* Check the results
display randvalloop;
Cheers
Renger

Re: random arrays in a table

Posted: Mon Nov 19, 2018 4:41 pm
by Mo216
Thank you so much!