My Math Forum  

Go Back   My Math Forum > High School Math Forum > Probability and Statistics

Probability and Statistics Basic Probability and Statistics Math Forum


Thanks Tree3Thanks
  • 2 Post By romsek
  • 1 Post By romsek
Reply
 
LinkBack Thread Tools Display Modes
October 13th, 2016, 05:38 PM   #1
Senior Member
 
Joined: Oct 2013
From: New York, USA

Posts: 606
Thanks: 82

I'm Looking For A Random Number Generator With Variable Probabilities

Free Online Random Number Generator and Checker is a random number generator where every number in the range is equally likely to be selected on any trial unless you place restrictions on frequencies, but you can't tell it to make one number more likely than another number. Can somebody find a random number generator where you can input the probabilities for each number? It doesn't need to be able to handle 100 probabilities, but I would like if it could handle 20 probabilities.
EvanJ is offline  
 
October 13th, 2016, 08:35 PM   #2
Senior Member
 
romsek's Avatar
 
Joined: Sep 2015
From: USA

Posts: 2,011
Thanks: 1044

probably the easiest way to do this is with a table.

Suppose you have $N$ events each having $p_k$ probability of occuring.

Further assume you have a random number generator that gives you uniform random real numbers [0,1].

Finally assume that you have some granularity of probability you are happy with so that you can write

$p_k = \dfrac {m_k}{M}$

Now you create a table.

The first $m_1$ entries point to the label for event 1

entries $m_1+1, m_1+m_2$ point to the label for event 2.

entries $m_{n-1}+1, m_{n-1}+m_n$ point to the label for event $n$

As a quick example to make this clear. Suppose we have 5 events with a probability granularity of $\dfrac 1{10}$

Let's say the $m_k$'s are $\{1,3,2,1,3\}$

We make a $10$ element array as follows

$\begin{bmatrix}
1\\ 2 \\ 2 \\ 2\\ 3 \\ 3 \\ 4 \\ 5 \\ 5 \\ 5 \end{bmatrix}$

You would get an RNG from your generator. Multiply it by 10 and round it to the nearest integer. Then use this an an index into the array and look up the corresponding event.
Thanks from topsquark and EvanJ

Last edited by romsek; October 13th, 2016 at 09:25 PM.
romsek is offline  
October 13th, 2016, 09:53 PM   #3
Senior Member
 
romsek's Avatar
 
Joined: Sep 2015
From: USA

Posts: 2,011
Thanks: 1044

Note that if you have a closed form formula for the probability of event $k$ in terms of $k$ there are easier ways of generating the random numbers with that distribution.

The table method is for when you just have a list of desired probabilities for your events w/o any particular formula.
Thanks from topsquark
romsek is offline  
October 14th, 2016, 11:15 AM   #4
Senior Member
 
Joined: Oct 2013
From: New York, USA

Posts: 606
Thanks: 82

Thank you. I'm working with www.random.org but I would still prefer if there was a random number generator that you could input your own probabilities for.
EvanJ is offline  
October 14th, 2016, 11:18 AM   #5
Senior Member
 
romsek's Avatar
 
Joined: Sep 2015
From: USA

Posts: 2,011
Thanks: 1044

Quote:
Originally Posted by EvanJ View Post
Thank you. I'm working with www.random.org but I would still prefer if there was a random number generator that you could input your own probabilities for.
so writing your own is out of the question?
romsek is offline  
October 14th, 2016, 06:07 PM   #6
Senior Member
 
Joined: Oct 2013
From: New York, USA

Posts: 606
Thanks: 82

Quote:
Originally Posted by romsek View Post
so writing your own is out of the question?
I can use the random number between 0 and 1 generator with decimal places. I don't know how to program a computer.
EvanJ is offline  
October 14th, 2016, 06:51 PM   #7
Senior Member
 
romsek's Avatar
 
Joined: Sep 2015
From: USA

Posts: 2,011
Thanks: 1044

were you going to use any software to do this?

just do it by hand?
romsek is offline  
October 16th, 2016, 07:16 AM   #8
Senior Member
 
Joined: Oct 2013
From: New York, USA

Posts: 606
Thanks: 82

Quote:
Originally Posted by romsek View Post
were you going to use any software to do this?

just do it by hand?
I was hoping to use a website but not any software.
EvanJ is offline  
Reply

  My Math Forum > High School Math Forum > Probability and Statistics

Tags
generator, number, probabilities, random, variable



Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Same probabilities of X in the Standardized Random Variable Z cydler Probability and Statistics 4 July 27th, 2015 01:33 PM
random variable! lawochekel Algebra 1 April 19th, 2012 12:39 PM
random variable topic rosalie Algebra 2 May 30th, 2010 01:10 AM
Random number generator of different distributions. oldjack Advanced Statistics 0 July 11th, 2009 06:30 PM
Random number generator grbradt Advanced Statistics 6 August 7th, 2007 02:21 PM





Copyright © 2018 My Math Forum. All rights reserved.