Sha256: 2f92bd9204d253cd30b08b6c5e5a97894e1d0c2d3a7aab44ee7bfd33497f4119

Contents?: true

Size: 492 Bytes

Versions: 1

Compression:

Stored size: 492 Bytes

Contents

# coding: utf-8
# $Id: rand.rb 120 2009-02-09 08:22:25Z yuyakato $

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
kagemusha-0.0.8 examples/rand.rb