Skip to content

Comment on Random numbers need not be uniformparent

Comments

For what it is worth: here is an example of a non-uniform random variate:

  a = [0,0,0,0,0,0,0,0,0,0]
  1000.times do
    a[5 *(rand + rand)] += 1
  end
results in (actual numbers may vary randomly):
  irb(main):020:0> a
  => [28, 60, 96, 151, 171, 168, 146, 96, 63, 21]
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.