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

Procedural Generation in Ruby

Alex Taylor
December 01, 2016

Procedural Generation in Ruby

A lightning talk I did at VanRuby in December 2016. I talked about video games and pseudo-random number generators!

Alex Taylor

December 01, 2016
Tweet

More Decks by Alex Taylor

Other Decks in Technology

Transcript

  1. Alex Taylor @mctaylorpants PRNG • Pseudo-random number generator • Appears

    random... • ...but actually deterministic rspec --seed 123
  2. Alex Taylor @mctaylorpants a = [1, 2, 3, 4, 5]

    srand(123) a.sample => 3 a.sample => 5 a.sample => 3 a.shuffle => [1, 5, 3, 4, 2] rand => 0.7800277619120791
  3. Alex Taylor @mctaylorpants a = [1, 2, 3, 4, 5]

    srand(123) a.sample => 3 a.sample => 5 a.sample => 3 a.shuffle => [1, 5, 3, 4, 2] rand => 0.7800277619120791
  4. Alex Taylor @mctaylorpants srand(123) a = ['n', 't', 'k', 'h',

    'a', 's'] a.shuffle.join => “thanks”