3
$\begingroup$

Ideally, the distribution over the acceptable pairs would be close to uniform.

x and the pair are all positive integers

(This is for code, so I need a constructive solution)

Thanks!

  • 0
    Is $x>0$? And should the random pair be just integers or positive integers?2012-12-23
  • 0
    I guess I could repeatedly generate uniform random ints between (1,x) for each and then throw away the pairs that don't work. But is there a more elegant solution?2012-12-23
  • 0
    x is an integer greater than 0 and the elements of the pair are also positive integers2012-12-23
  • 0
    Could you add that to your post?2012-12-23
  • 0
    Do you mean to draw uniformly from ordered pairs, or unordered pairs?2012-12-23

3 Answers 3