Skip to content

Instantly share code, notes, and snippets.

@jarinudom
Created November 14, 2012 22:03
Show Gist options
  • Select an option

  • Save jarinudom/4075144 to your computer and use it in GitHub Desktop.

Select an option

Save jarinudom/4075144 to your computer and use it in GitHub Desktop.

Revisions

  1. jarinudom created this gist Nov 14, 2012.
    14 changes: 14 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    #!/usr/bin/ruby -w
    require 'digest/md5'

    filename = 'myimage.png'

    # Generate a hash from the file contents
    digest = Digest::MD5.hexdigest(File.read(filename))

    # Mersenne Twister RNG with seed
    prng = Random.new(digest)

    # Generate numbers
    strength = prng.integer(20)
    agility = prng.integer(20)