Skip to content

matsumotory/mruby-random

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 

This mrbgem was included in mruby/mruby

This mrbgem is random class sample.

Random Module for mruby

mruby random module with Mersenne Twister.

base code are mt19937ar.sep.tgz and iij/mruby

install by mrbgems

  • add conf.gem line to build_config.rb
MRuby::Build.new do |conf|

    # ... (snip) ...

    conf.gem :git => 'https://github.com/matsumoto-r/mruby-random.git'
end

example

Random::srand(10)
hoge = Random::rand()
Random::srand(20)
fuga = Random::rand()
Random::srand(10)
foo = Random::rand()

puts hoge == fuga
puts hoge == foo

3.times do |i|
  puts Random::rand()
  puts Random::rand(0)
  puts Random::rand(10)
  puts Random::rand(50)
  puts Random::rand(100)
end

License

under the MIT License:

About

mruby-random

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published