Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: Generate non integer number
Replies: 4   Last Post: Mar 13, 2013 1:39 PM

 Messages: [ Previous | Next ]
 John D'Errico Posts: 9,128 Registered: 12/7/04
Re: Generate non integer number
Posted: Mar 13, 2013 1:39 PM

"max200790" wrote in message <khq12l\$1kc\$1@newscl01ah.mathworks.com>...
> Hi,
> I would know how I can generate a non integer number with the function randi without utilizing a division or multiplication.
>
> Maybe we know another function which only specifying the interval give the random value as:
>
> Amin=0
> Amax=5
> A=......([Amin,Amax])
>
>
> A=1.954
>

Well, without telling us WHY you want to do this
(yes, I know its homework) or what distribution

A = randi(1) + 0.5;

A will always be non-integer. Clearly it satisfies your
requirements as stated, but I fear it does not do
what you need. But how do we know what you
really need?

John

Date Subject Author
3/13/13 Curious
3/13/13 Alan Weiss
3/13/13 Curious
3/13/13 John D'Errico