Search All of the Math Forum:

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: how can generate random integer numbers?
Replies: 8   Last Post: Mar 19, 2013 6:02 PM

 Messages: [ Previous | Next ]
 Steven Lord Posts: 18,038 Registered: 12/7/04
Re: how can generate random integer numbers?
Posted: Mar 19, 2013 5:22 PM

"Francesco Perrone" <francesco86perrone@yahoo.it> wrote in message
news:kiabv1\$d1i\$1@newscl01ah.mathworks.com...
> "Sahan " <sahanbull@gmail.com> wrote in message
> <kiabef\$bgo\$1@newscl01ah.mathworks.com>...

>> emanuele <emanuelemignosa@yahoo.it> wrote in message
>> <ef1bf39.-1@webx.raydaftYaTP>...

>> > Hi all
>> > how can generate random integer numbers?
>> > Thanks in advantage Emanuele

>>
>>
>> Well, you can use randint function eg: to get uniform random integer
>> vector of (1x10) with random number 1 to 1000
>>
>> test = randint(1,10,[1 1000])

>
> I would use randi function.

If the numbers need to be generated with replacement from the discrete
uniform distribution on integer values, use RANDI. If they need to be
generated without replacement from the discrete uniform distribution, use
RANDPERM. If they need to be generated with a nonuniform distribution,
things get more tricky.

--
Steve Lord
slord@mathworks.com
http://www.mathworks.com

Date Subject Author
11/17/05 Emanuele
11/17/05 Nasser Abbasi
11/17/05 Roger Stafford
11/17/05 Subhasri krishnan
11/17/05 Ken Campbell
3/19/13 Francesco Perrone
3/19/13 Steven Lord
3/19/13 Peter Perkins