Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Rando

 Rando

A lightning talk in which we learn a bit about Ruby by working with random values.

Tim Uruski

May 14, 2014
Tweet

More Decks by Tim Uruski

Other Decks in Programming

Transcript

  1. users = %w[alice bob carol] subset = Array.new(2) { users[rand

    * users.length] } => ['bob', 'alice'] 31
  2. users = %w[alice bob carol] subset = Array.new(2) { users[rand

    * users.length] } => ['bob', 'alice'] NO! 32
  3. require 'securerandom' token = SecureRandom.hex(40) => '6011e8861f024cb75...' => '8f90ea2187b50cb52...' =>

    'cad2eb20a39939601...' => '272a822296de5b249...' => 'ad65839e646c27252...' 47