LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

generating random number from exponential distribution

Hey everyone. I'm sure this is simple, but I can't seem to find any info on how to do it. 

 

I need to generate a single random value from a two-number range (user entered limits) using an exponential distribution. Any help is much appreciated. 

0 Kudos
Message 1 of 9
(4,146 Views)

The most general case of generating a random distribution with a desired probaility profile is described here, but you could probably simplify for your case. Try it.

0 Kudos
Message 2 of 9
(4,141 Views)

@altenbach wrote:

The most general case of generating a random distribution with a desired probaility profile is described here, but you could probably simplify for your case. Try it.


I'm not sure I'm following the code you've linked to, but I'm fairly certain that as you've implied, I need something much simpler. I'll try to do it mathematically from a mathscript node, or something. 

0 Kudos
Message 3 of 9
(4,118 Views)

... That's why I said you could simplify. First we need a less ambiguous problem description.

 

I can think of several ways to interpret "exponential". Can you be a bit more specific how probability depends on the range and range bounds.

0 Kudos
Message 4 of 9
(4,107 Views)

Here is my idea of what I would do based on your description.

 

Take your range min and max, do the exponential math on it to come up with a new min and max.

Use that min and max and do a normal random number based on that.

Take the random number you get, and do the math for the inverse of the exponential you did in step one.

0 Kudos
Message 5 of 9
(4,085 Views)

RavensFan wrote:

Use that min and max and do a normal random number based on that.


you need to be careful with the word "normal". It could imply a random number with a normal distribution. Is that what you meant?

 

0 Kudos
Message 6 of 9
(4,073 Views)

Nope.  Not that "normal" as in normal distribution.  I just meant normal as the ordinary English word, just the basic random number generator present in the numeric palette.

 

Thanks for pointing that out to help avoid any confusion by my choice of words.

 

 

0 Kudos
Message 7 of 9
(4,067 Views)

I did the math in a node. I was just hoping LabView might have a simple VI that could do it. Thanks.

0 Kudos
Message 8 of 9
(4,039 Views)

@user0110 wrote:

I did the math in a node. I was just hoping LabView might have a simple VI that could do it. Thanks.


Of course LabVIEW has a simpler way!

 

As I said, the word "exponentioal" is too ambiguous. You need to tell us the math you want to use, but you have not yet. Can you show us your current code so we get a better understanding how the output should behave based on the input range?

0 Kudos
Message 9 of 9
(4,029 Views)