1
2
3
4
alphanumerics = [*('0'..'9')] + [*('A'..'Z')] + [*('a'..'z')]
(0...25).map { alphanumerics[Kernel.rand(alphanumerics.size)] }.join

...

Ruby Generating a string of rand...

by scudco, July 02, 2008 18:23, 4 refactorings, tagged with random character, random

So this is kind of trivial ...

7bdb696ac0f589522c9ed31a1b24057b Talk
1
2
3
4
module DiscreteDistribution
  
  # pick_random is useful for spliting up a collection by its specified discrete distribution
...

Ruby Randomly pick an item base ...

by David Dai, June 15, 2008 06:02, No refactoring, tagged with random, algorithm, discrete, discrete distribution, ruby, load balance, multivariate, ab-test

This method is useful to lo...

535215c41c0949117577517b4506202c Talk