Ruby 1.9.2 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Randomクラス
クラスの継承リスト: Random < Object < Kernel < BasicObject
MT19937に基づく疑似乱数生成器を提供するクラスです。
オリジナル版 http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/mt.html
定義 | 説明 | |
---|---|---|
new(seed = Random.new_seed) -> Random
|
メルセンヌ・ツイスタに基づく疑似乱数発生装置オブジェクトを作ります。 引数が省略された場合は、Random.new_seedの値を使用します。 |
|
new_seed -> Integer
|
適切な乱数の種を返します。 |
|
rand(max=0) -> Float
|
疑似乱数を発生させます。 |
|
srand(number=0) -> Integer
|
疑似乱数生成器の種を設定します。 |
定義 | 説明 | |
---|---|---|
self == other -> bool
|
乱数生成器が等しい状態であるならばtrue を返します。 |
|
bytes(size) -> String
|
ランダムなバイナリー文字列を返します。結果の文字列のサイズを指定できます。 |
|
marshal_dump -> Array
|
Random#marshal_load で復元可能な配列を返します。 |
|
marshal_load(array) -> Random
|
Random#marshal_dump で得られた配列を基に、Randomオブジェクトを復元します。 |
|
rand -> Float
|
浮動小数点数を返します。 |
|
rand(arg) -> Integer
|
arg が IntegerもしくはBignumの場合は、arg 未満の整数を返します。 Rangeオブジェクトの場合はrange.member?(number) == trueになるような数値を返します。 |
|
seed -> Integer
|
現在の乱数の種を返します。 |
定義 | 説明 | |
---|---|---|
left -> Integer
|
C言語レベルで定義されている構造体MTの静的変数default_randの変数leftを参照します。詳しくはrandom.c を参照してください。 |
|
state -> Integer
|
C言語レベルで定義されている構造体MTの静的変数default_randの状態を参照します。詳しくはrandom.c を参照してください。 |
定義 | 説明 | |
---|---|---|
left -> Integer
|
C言語レベルで定義されている構造体MTの変数leftを参照します。詳しくはrandom.c を参照してください。 |
|
state -> Integer
|
C言語レベルで定義されている構造体MTの状態を参照します。詳しくはrandom.c を参照してください。 |
!
!=
===
=~
__id__
__send__
_dump
class
clone
dclone
display
enum_for
eql?
equal?
extend
freeze
frozen?
hash
initialize
initialize_copy
inspect
instance_eval
instance_exec
instance_of?
instance_variable_defined?
instance_variable_get
instance_variable_set
instance_variables
is_a?
method
method_missing
methods
must_be
must_be_close_to
must_be_empty
must_be_instance_of
must_be_kind_of
must_be_nil
must_be_same_as
must_be_within_epsilon
must_equal
must_include
must_match
must_raise
must_respond_to
must_send
must_throw
nil?
pretty_inspect
pretty_print
pretty_print_cycle
pretty_print_inspect
pretty_print_instance_variables
private_methods
protected_methods
public_methods
remove_instance_variable
respond_to?
respond_to_missing?
singleton_class
singleton_method_added
singleton_method_removed
singleton_method_undefined
singleton_methods
taint
tainted?
tap
to_a
to_ary
to_hash
to_int
to_io
to_proc
to_regexp
to_s
to_str
to_yaml
to_yaml_properties
to_yaml_style
trust
untaint
untrust
untrusted?
wont_be
wont_be_close_to
wont_be_empty
wont_be_instance_of
wont_be_kind_of
wont_be_nil
wont_be_same_as
wont_be_within_epsilon
wont_equal
wont_include
wont_match
wont_respond_to