D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Random
/
Filename :
cdesc-Random.ri
back
Copy
U:RDoc::NormalClass[iI"Random:ET@I" base;To:RDoc::Markup::Document:@parts[o;;[o:RDoc::Markup::Paragraph;[ I"ORandom provides an interface to Ruby's pseudo-random number generator, or ;TI"QPRNG. The PRNG produces a deterministic sequence of bits which approximate ;TI"Ntrue randomness. The sequence may be represented by integers, floats, or ;TI"binary strings.;To:RDoc::Markup::BlankLine o; ;[I"HThe generator may be initialized with either a system-generated or ;TI"4user-supplied seed value by using Random.srand.;T@o; ;[I"QThe class method Random.rand provides the base functionality of Kernel.rand ;TI"Ialong with better handling of floating point values. These are both ;TI"(interfaces to the Ruby system PRNG.;T@o; ;[ I"LRandom.new will create a new PRNG with a state independent of the Ruby ;TI"Msystem PRNG, allowing multiple generators with different seed values or ;TI"Gsequence positions to exist simultaneously. Random objects can be ;TI";marshaled, allowing sequences to be saved and resumed.;T@o; ;[I"RPRNGs are currently implemented as a modified Mersenne Twister with a period ;TI"Rof 2**19937-1. As this algorithm is _not_ for cryptographical use, you must ;TI"Ause SecureRandom for security purpose, instead of this PRNG.;T@o; ;[I"QSee also Random::Formatter module that adds convenience methods to generate ;TI""various forms of random data.;T: @fileI" random.c;T:0@omit_headings_from_table_of_contents_below0;0;0[ [ [ [[I" class;T[[:public[[I" bytes;TI" random.c;T[I"new;T@8[I" new_seed;T@8[I" rand;T@8[I" seed;T@8[I" srand;T@8[I"urandom;T@8[:protected[ [:private[ [I" instance;T[[; [ [I"==;T@8[I" bytes;T@8[I" rand;T@8[I" seed;T@8[;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ;0;0[I"lib/random/formatter.rb;T@,@,cRDoc::TopLevel