Re: number generator



Dick Moores <rdm@xxxxxxxxxx> wrote:

But let's say there is one more constraint--that for each n of the N
positive integers, there must be an equal chance for n to be any of
the integers between 1 and M-N+1, inclusive. Thus for M == 50 and N
== 5, the generated list of 5 should be as likely to be [1,46,1,1,1]
as [10,10,10,10,10] or [14, 2, 7, 1, 26].

I don't think what you wrote actually works. Any combination including a 46
must also have four 1s, so the digit 1 has to be at least 4 times as likely
to appear as the digit 46, and probably a lot more likely than that.

On the other hand, making sure that each combination occurs equally often
(as your example might imply) is doable but still leaves the question
whether the order of the numbers matters: are [1,46,1,1,1] and [1,1,46,1,1]
the same or different combinations?

The sorted/sample/xrange solution seems to give an even distribution or
ordered combinations, I don't know what algorithm (short of enumerating all
possible solutions and choosing one at random) gives an even distribution
when the ordering doesn't matter.
.



Relevant Pages

  • Quantum Gravity 308.94: An Upside Down Fermats Last Theorem?
    ... physics applications. ... as for example the continuous uniform distribution (often just ...
    (sci.physics)
  • Re: Request comment on Probability calculation scenario
    ... >Suppose you "arbitrarily select" 4 positive integers. ... >circles are drawn with one having a center at C1 and the other having ... >limit of the 'Intersection Probability'? ... You can't do any exact calculations without some kind of distribution. ...
    (sci.math)
  • Re: Normal (Distribution) Approximation
    ... > I should probably clarify my question a bit more. ... your y-values are positive integers, maybe a binomial or other discrete ... distribution should be fit and graphed along with the empirical ... better fit than the normal. ...
    (sci.stat.math)
  • Re: A Discrete Random Variable
    ... Let m and n be positive integers, ... structure of probability space considering all a's ... The distribution may be difficult, ... write X as the sum of mn Bernoulli random variables. ...
    (sci.math)
  • Re: Random with Number And Probability [very long]
    ... Combinations wouldn't seem to have much correlation to ... > distribution. ... Combinations assumes equal chance between numbers I would ... is playing with it..... ...
    (microsoft.public.excel.programming)