Thread Subject: random numbers

Subject: random numbers

From: Jessica

Date: 29 Jul, 2008 07:30:04

Message: 1 of 5

Hi,

I am trying to generate a list of 36 random numbers. I am
using:

RandomNumber=randperm(36);

However, my problem is that I generate the exact same
sequence every time that I run the command for the first
time (directly after opening Matlab). Is there a way to
specify a random seed so that I get a different sequence
each time I run the command?

Thanks!

Jessica

Subject: random numbers

From: Yumnam Kirani Singh

Date: 29 Jul, 2008 07:49:56

Message: 2 of 5

See help on rand to set the state of random number generation.

Subject: random numbers

From: Jessica

Date: 29 Jul, 2008 21:34:03

Message: 3 of 5

Yumnam Kirani Singh <kirani.singh@gmail.com> wrote in
message
<5169857.1217317827085.JavaMail.jakarta@nitrogen.mathforum.o
rg>...
> See help on rand to set the state of random number
generation.


After reading the help, I still don't really understand how
to generate a new random number list each time. Can you
provide an example? Thanks!

Subject: random numbers

From: dpb

Date: 29 Jul, 2008 21:41:33

Message: 4 of 5

Jessica wrote:
...

> After reading the help, I still don't really understand how
> to generate a new random number list each time. Can you
> provide an example? Thanks!

One technique would be something like the example in the help --

"RAND('state',sum(100*clock)) resets it to a different state each time."

--



Subject: random numbers

From: Ken Campbell

Date: 30 Jul, 2008 18:48:02

Message: 5 of 5

dpb <none@non.net> wrote in message <g6o2vt$ur8$1@aioe.org>...
> Jessica wrote:
> ...
>
> > After reading the help, I still don't really understand how
> > to generate a new random number list each time. Can you
> > provide an example? Thanks!
>
> One technique would be something like the example in the
help --
>
> "RAND('state',sum(100*clock)) resets it to a different
state each time."
>
> --
>

Ooops, the tag was a mistake.

But you might want to check this thread as well

http://www.mathworks.com/matlabcentral/newsreader/view_thread/169642#433242

Ken

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
ken campbell Ken Campbell 30 Jul, 2008 14:45:09
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com