random numbers -1 +1 with 2 decimals without any distribution
Show older comments
Dear all, How can I generate random numbers ranging between -1 to +1 with 2 decimals and without any kind of distribution? Thanks in advance, Diego
Accepted Answer
More Answers (1)
Image Analyst
on 8 Jan 2012
Perhaps you're simply looking for something like this:
a = -1; % Lower (min) value.
b = +1; % Upper (max) value
numberOfSamples = 50;
% Create r. Range of r is a to b.
r = a + (b-a).*rand(numberOfSamples, 1)
% Chop off beyond 2 decimal places.
samples = floor(r * 100) / 100
Categories
Find more on Correlation and Convolution in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!