るりまサーチ

最速Rubyリファレンスマニュアル検索!
52件ヒット [1-52件を表示] (0.022秒)

別のキーワード

  1. random rand
  2. random seed
  3. random srand
  4. random state
  5. random left

ライブラリ

クラス

キーワード

検索結果

Random.new(seed = Random.new_seed) -> Random (27684.0)

メルセンヌ・ツイスタに基づく擬似乱数発生装置オブジェクトを作ります。 引数が省略された場合は、Random.new_seedの値を使用します。

...す。
引数が省略された場合は、Random.new_seedの値を使用します。


@param seed 擬似乱数生成器の種を整数で指定します。

//emlist[例: 種が同じなら同じ乱数列を発生できる。][ruby]{
prng = Random.new(1234)
[ prng...
...and ] #=> [0.1915194503788923, 0.6221087710398319]
[ prng.rand(10), prng.rand(1000) ] #=> [4, 664]
# 同じ乱数列を発生する。
prng = Random.new(1234)
[ prng.rand, prng.rand ] #=> [0.1915194503788923, 0.6221087710398319]
[ prng.rand(10), prng.rand(1000)...

Random#seed -> Integer (27119.0)

現在の乱数の種を返します。

...現在の乱数の種を返します。

//emlist[例][ruby]{
p Random.new(3).seed # => 3
//}...

Random.new_seed -> Integer (21220.0)

適切な乱数の種を返します。

...適切な乱数の種を返します。

//emlist[例][ruby]{
p Random.new_seed # => 184271600931914695177248627591520900872
//}...

NEWS for Ruby 2.5.0 (6084.0)

NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...NEWS for Ruby 2.5.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス...
...* https://blog.rubygems.org/2017/10/09/2.6.14-released.html
* https://blog.rubygems.org/2017/08/27/2.6.13-released.html

* securerandom
* SecureRandom.alphanumeric を追加

* set
* Set#to_s を Set#inspect の別名として追加 13676
* Set#=== を Set#include? の別名...
...nblock で
副作用として O_NONBLOCK フラグをセットするのをやめました(Linux のみ)
13362

* Random
* Random.raw_seed Random.urandom に名前を変更しました。
シードを必要としない用途で有用です。9569

* Socket
* Socket::...

OpenSSL::PKey::RSA (42.0)

RSA 暗号鍵のクラスです。

...RSA 暗号鍵のクラスです。

通常このクラスで利用するのは、
OpenSSL::PKey::RSA.generate, OpenSSL::PKey::RSA.new,
OpenSSL::PKey::RSA#public?, OpenSSL::PKey::RSA#private?,
OpenSSL::PKey::RSA#public_key, OpenSSL::PKey::RSA#to_text,
OpenSSL::PKey::RSA#to_pem, OpenSSL::PKey::RSA#to_...
...RSA についてよく理解し、必要な場合のみにすべきです。


例:
require 'openssl'

# initialize random seed
OpenSSL::Random.seed(File.read("/dev/random", 16))
# 鍵対を生成
rsa = OpenSSL::PKey::RSA.generate(2048)
# 秘密鍵をAES256で暗号化して private_key...
....pem に PEM 形式で保存
passphrase = "!secret passphrase!"
File.open("private_key.pem", "w") do |f|
f.write(rsa.export(OpenSSL::Cipher.new("aes256"), passphrase))
end
# 公開鍵をpublic_key.pemに保存
public_key = rsa.public_key
File.open("public_key.pem", "w") do |f|
f....

絞り込み条件を変える

test/unit (30.0)

ユニットテストを行うためのライブラリです。

...が必ず呼ばれます。

require 'test/unit'
require 'foo'

class TC_Foo < Test::Unit::TestCase
def setup
@obj = Foo.new
end

# def teardown
# end

def test_foo
assert_equal("foo", @obj.foo)
end
def test_bar
assert_equ...
....rb --help
Usage: test_foo [options]
minitest options:
-h, --help Display this help.
-s, --seed SEED Sets random seed
-v, --verbose Verbose. Show progress processing files.
-n, --name PATTERN Filter t...