Thread Subject: help

Subject: help

From: jean

Date: 16 Nov, 2009 19:16:19

Message: 1 of 4

i have to generate a random number in an infinite range. could u please help me?

Subject: help

From: Matt

Date: 16 Nov, 2009 19:51:02

Message: 2 of 4

"jean " <atango1234@yahoo.fr> wrote in message <hds8e2$447$1@fred.mathworks.com>...
> i have to generate a random number in an infinite range. could u please help me?

How about the following

result=1/rand-1/rand; %A randum number in [-inf,inf]

Subject: help

From: Matt

Date: 16 Nov, 2009 19:58:03

Message: 3 of 4

"jean " <atango1234@yahoo.fr> wrote in message <hds8e2$447$1@fred.mathworks.com>...
> i have to generate a random number in an infinite range. could u please help me?

Here's another one

result=log(log(1/rand));

Subject: help

From: the cyclist

Date: 16 Nov, 2009 20:31:03

Message: 4 of 4

"jean " <atango1234@yahoo.fr> wrote in message <hds8e2$447$1@fred.mathworks.com>...
> i have to generate a random number in an infinite range. could u please help me?

You told us the range, but does it have to have a specific distribution? Hopefully not uniform. 8-)

>> randn(1)

gives a random number from the unit normal, which has an infinite range.

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
rand Matt J 17 Nov, 2009 12:03:46
rssFeed for this Thread

Contact us at files@mathworks.com