Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

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

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.

Contact us