Procedural Generation in Ruby

Da0b02303090f0ded442767e58a98626?s=47 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!

Da0b02303090f0ded442767e58a98626?s=128

Alex Taylor

December 01, 2016
Tweet

Transcript

  1. 10.

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

    random... • ...but actually deterministic rspec --seed 123
  2. 12.

    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. 14.

    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. 17.

    Alex Taylor @mctaylorpants srand(123) a = ['n', 't', 'k', 'h',

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