cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.
  • See how to access JMP Marketplace - and - find, create & share add-ins to extend your JMP. Watch video.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Shunee
Level I

Can I set the random seed for random uniform function?

I try to generate a constant random number everytime I run the script. Is there anyway to do that?

1 ACCEPTED SOLUTION

Accepted Solutions
ian_jmp
Level X

Re: Can I set the random seed for random uniform function?

Take a look at 'RandomReset()':

Names Default To Here( 1 );

nr = 10;
nc = 10;
mat = J(nr, nc, .);

for (c=1, c<=nc, c++,
	Random Reset( 1 );
	mat[0,c] = J(nr, 1, RandomUniform());
);
dt1 = AsTable(mat);
dt1 << setName("Columns the same");

for (c=1, c<=nc, c++,
	Random Reset( 666 );
	mat[0,c] = J(nr, 1, RandomUniform());
);
dt2 = AsTable(mat);
dt2 << setName("Columns the same");

 

View solution in original post

2 REPLIES 2
ian_jmp
Level X

Re: Can I set the random seed for random uniform function?

Take a look at 'RandomReset()':

Names Default To Here( 1 );

nr = 10;
nc = 10;
mat = J(nr, nc, .);

for (c=1, c<=nc, c++,
	Random Reset( 1 );
	mat[0,c] = J(nr, 1, RandomUniform());
);
dt1 = AsTable(mat);
dt1 << setName("Columns the same");

for (c=1, c<=nc, c++,
	Random Reset( 666 );
	mat[0,c] = J(nr, 1, RandomUniform());
);
dt2 = AsTable(mat);
dt2 << setName("Columns the same");

 

Shunee
Level I

Re: Can I set the random seed for random uniform function?

Thank you! Random Reset() work.

Recommended Articles