Sha256: a2c3962fec5609d70ec1b392f8e6ce8859ed6125ce4cb9ea4555a18f4c2067c9

Contents?: true

Size: 492 Bytes

Versions: 1

Compression:

Stored size: 492 Bytes

Contents

# coding: utf-8
# $Id: rand.rb 108 2009-02-09 06:04:39Z 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
nayutaya-kagemusha-0.0.9 examples/rand.rb