Sha256: a6b25f05a375f25ef0a89dd5f3bcdaad6617f009becb2cc0680112bbf3f9e3a7

Contents?: true

Size: 441 Bytes

Versions: 1

Compression:

Stored size: 441 Bytes

Contents

# coding: utf-8

require "rubygems"
require "kagemusha/rand"

p rand(100) #=> rand
p rand(100) #=> rand
puts "---"

# Normal Style.
musha = Kagemusha::Rand.always(1)
musha.swap {
  p rand(100) #=> 1
  p rand(100) #=> 1
  puts "---"
}

p rand(100) #=> rand
p rand(100) #=> rand
puts "---"

# Block Style.
Kagemusha::Rand.always(1) {
  p rand(100) #=> 1
  p rand(100) #=> 1
  puts "---"
}

p rand(100) #=> rand
p rand(100) #=> rand
puts "---"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nayutaya-kagemusha-0.1.0 examples/rand.rb