From: Otis Luo on
Hi, how to generate random float number in a fixed range, such as between 70 to 80.
From: us on
"Otis Luo" <luowei86(a)gmail.com> wrote in message <hopplq$9lt$1(a)fred.mathworks.com>...
> Hi, how to generate random float number in a fixed range, such as between 70 to 80.

one of the solutions

hi=80;
lo=70;
nr=100000;
r=lo+(hi-lo)*rand(1,nr);
disp([min(r);max(r)]);
%{
70
80
%}

us
From: Otis Luo on
"us " <us(a)neurol.unizh.ch> wrote in message <hopqc9$k35$1(a)fred.mathworks.com>...
> "Otis Luo" <luowei86(a)gmail.com> wrote in message <hopplq$9lt$1(a)fred.mathworks.com>...
> > Hi, how to generate random float number in a fixed range, such as between 70 to 80.
>
> one of the solutions
>
> hi=80;
> lo=70;
> nr=100000;
> r=lo+(hi-lo)*rand(1,nr);
> disp([min(r);max(r)]);
> %{
> 70
> 80
> %}
>
> us
thank u, i got it