How can I use a random seed continually ?
Afficher commentaires plus anciens
Hi I have a question about random seed. I want to use a two-random seed continually.
For example, when i=1, I use seed 1's first number in m-file and seed 2's first number in function. and next i=2, I want use seed 1's second number in m-file and seed 2's second number in function.
but below code is when i=1, I use seed 1's first number in m-file and seed 2's first number in function. and next i=2, I will use seed 2's second number in m-file and seed 2's third number in function.
This is pseudo code for understanding
-------------------------------------------------------------------------------------------
rng(1)
for i=1:100
A(i,1)=rand('unid',1)
B=(i,1)= function( A(i,1) )
% function y=function(x)
% rng(2)
% a=rand('unid',1)
% y=a + x
end
-------------------------------------------------------------------------------------------
How can I set the code? Thanks.
Réponses (1)
Walter Roberson
le 12 Oct 2016
0 votes
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!