Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!news2.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe15.iad.POSTED!7564ea0f!not-for-mail
From: "Nasser M. Abbasi" <nma@12000.org>
Newsgroups: comp.soft-sys.matlab
References: <hd57r0$8c2$1@fred.mathworks.com> <VBpJm.18763$Wd1.2960@newsfe15.iad>
Subject: Re: choosing a number at random
Lines: 25
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3598
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350
X-RFC2646: Format=Flowed; Response
X-EsetId: 321EA926BF203339695A
X-EsetScannerBuild: 5991
Message-ID: <AGpJm.18810$Wd1.2254@newsfe15.iad>
NNTP-Posting-Host: ncdeodfefpjopplmihjclpliaacepnnh
X-Complaints-To: abuse@charter.net
X-Trace: ibafepnipngekpdoadefjppgkgeilljaofolpbdcfmampiaoncdeodfefpjopplmmgdmmdanmgdmojgmflnfinihkdlfgceiildolkkeocphpjlemmljgcampeckjphacggpekigbfidlfdi
NNTP-Posting-Date: Sun, 08 Nov 2009 02:04:16 UTC
Date: Sat, 7 Nov 2009 20:04:14 -0600
Xref: news.mathworks.com comp.soft-sys.matlab:583284



"Nasser M. Abbasi" <nma@12000.org> wrote in message 
news:VBpJm.18763$Wd1.2960@newsfe15.iad...
>
> "Monica " <moh__krez@hotmail.com> wrote in message 
> news:hd57r0$8c2$1@fred.mathworks.com...
>>I need Matlab to choose a number between 1 and 10 at random, but I'm not 
>>sure how to go about doing this.
>
> If you want the random number to be drawn from uniform distribution, which 
> I assume that is what you want, then do
>
> r = 10*rand
>
>

opps, you wanted it from 1 to 10, then do

r = 1+9*rand

(see help on rand)

--Nasser