Generate n random numbers between 0.1 and 0.9 without repetition
Hi all,
I need to generate random points where and , excluding the point . My attempt is the following:
%define the lower limit
lower_limit = 0.1;
%define the upper limit
higher_limit = 0.9;
%No of random points
No_pts = 20;
%excluding value
No_value = 0.5
%Generate
valid_vals = setdiff(lower_limit:higher_limit, No_value);
result = valid_vals( randi(length(valid_vals), No_pts, 2) );
When running this code I only get one value which is . Any idea how this can be modified to work properly?
Thanks.Hi all,
I need to generate random points where and , excluding the point . My attempt is the following:
%define the lower limit
lower_limit = 0.1;
%define the upper limit
higher_limit = 0.9;
%No of random points
No_pts = 20;
%excluding value
No_value = 0.5
%Generate
valid_vals = setdiff(lower_limit:higher_limit, No_value);
result = valid_vals( randi(length(valid_vals), No_pts, 2) );
When running this code I only get one value which is . Any idea how this can be modified to work properly?
Thanks. Hi all,
I need to generate random points where and , excluding the point . My attempt is the following:
%define the lower limit
lower_limit = 0.1;
%define the upper limit
higher_limit = 0.9;
%No of random points
No_pts = 20;
%excluding value
No_value = 0.5
%Generate
valid_vals = setdiff(lower_limit:higher_limit, No_value);
result = valid_vals( randi(length(valid_vals), No_pts, 2) );
When running this code I only get one value which is . Any idea how this can be modified to work properly?
Thanks. random, points, vectors, matlab MATLAB Answers — New Questions