Oh wait. Sorry. So, the way that @chriseppstein implemented this, its actually "Random.rand($limit) + 1" So, while the ruby implementation is not inclusive, by adding one, we are making ours inclusive of the limit.