るりまサーチ

最速Rubyリファレンスマニュアル検索!
1628件ヒット [1-100件を表示] (0.072秒)
トップページ > クエリ:Integer[x] > クエリ:new[x] > 種類:インスタンスメソッド[x]

別のキーワード

  1. openssl integer
  2. asn1 integer
  3. _builtin integer
  4. integer new
  5. integer chr

ライブラリ

キーワード

検索結果

<< 1 2 3 ... > >>

Integer#prime_division(generator = Prime::Generator23.new) -> [[Integer, Integer]] (21304.0)

自身を素因数分解した結果を返します。

自身を素因数分解した結果を返します。

@param generator 素数生成器のインスタンスを指定します。

@return 素因数とその指数から成るペアを要素とする配列です。つまり、戻り値の各要素は2要素の配列 [n,e] であり、それぞれの内部配列の第1要素 n は self の素因数、第2要素は n**e が self を割り切る最大の自然数 e です。

@raise ZeroDivisionError self がゼロである場合に発生します。

@see Prime#prime_division

//emlist[例][ruby]{
require 'prime'
12.p...

Integer#to_bn -> OpenSSL::BN (21035.0)

Integer を同じ数を表す OpenSSL::BN のオブジェクトに 変換します。

...
Integer
を同じ数を表す OpenSSL::BN のオブジェクトに
変換します。

//emlist[][ruby]{
require 'pp'
require 'openssl'

pp 5.to_bn #=> #<OpenSSL::BN 5>
pp (-5).to_bn #=> #<OpenSSL::BN -5>
//}

なお、実装は、以下のようになっています。

//emlist[][ruby]{
clas...
...s Integer
def to_bn
OpenSSL::BN::new(self)
end
end
//}

@see OpenSSL::BN.new, OpenSSL::BN#to_i...
...
Integer
を同じ数を表す OpenSSL::BN のオブジェクトに
変換します。

//emlist[][ruby]{
require 'openssl'

pp 5.to_bn #=> #<OpenSSL::BN 5>
pp (-5).to_bn #=> #<OpenSSL::BN -5>
//}

なお、実装は、以下のようになっています。

//emlist[][ruby]{
class Integer
d...
...ef to_bn
OpenSSL::BN::new(self)
end
end
//}

@see OpenSSL::BN.new, OpenSSL::BN#to_i...

Rinda::SimpleRenewer#renew -> Integer (9208.0)

TupleSpace からオブジェクトの寿命を問合せるために呼び出されます。

...TupleSpace からオブジェクトの寿命を問合せるために呼び出されます。

このメソッド自体は Rinda::SimpleRenewer.new で指定した秒数を
返します。...

JSON::Generator::GeneratorMethods::Integer#to_json(state_or_hash = nil) -> String (3007.0)

自身から生成した JSON 形式の文字列を返します。

...する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。

//emlist[例][ruby]{
require "json"

10.to_json # => "10"
//}...

Prime#prime_division(value, generator= Prime::Generator23.new) -> [[Integer, Integer]] (304.0)

与えられた整数を素因数分解します。

与えられた整数を素因数分解します。

@param value 素因数分解する任意の整数を指定します。

@param generator 素数生成器のインスタンスを指定します。

@return 素因数とその指数から成るペアを要素とする配列です。つまり、戻り値の各要素は2要素の配列 [n,e] であり、それぞれの内部配列の第1要素 n は value の素因数、第2要素は n**e が value を割り切る最大の自然数 e です。

@raise ZeroDivisionError 与えられた数値がゼロである場合に発生します。

//emlist[例][ruby]{
require 'p...

絞り込み条件を変える

OpenSSL::SSL::SSLContext#ciphers -> [[String, String, Integer, Integer]] (209.0)

利用可能な共通鍵暗号の種類を配列で返します。

...SSL/TLSのバージョン文字列, 鍵長(ビット数), アルゴリズムのビット長]
例:
require 'openssl'
ctx = OpenSSL::SSL::SSLContext.new('TLSv1')
ctx.ciphers
# => [["DHE-RSA-AES256-SHA", "TLSv1/SSLv3", 256, 256],
# ["DHE-DSS-AES256-SHA", "TLSv1/SSLv3", 256, 256], ... ]...

Random#rand(max) -> Integer | Float (157.0)

一様な擬似乱数を発生させます。

...が存在しない範囲を渡した時などに発生します。

//emlist[例][ruby]{
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand # => 0.1915194503788923
srand(1234)
rand # => 0.1915194503788923

# max に実数も指定出来る
prng...
...
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
require 'date'
prng.rand(Date.new(2012, 1, 1) ... Date.new(2013,1,1)) # => #<Date: 2012-01-31 ((2455958j,0s,0n),+0s,2299161j)>
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand...
...3.6148130397862865
# 2012年のすべての時刻から一つ選ばれる
# Time#- は秒数を float で返すため。
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
# DateTime ではうまくいかない。というのは DateTime#- は
# Rational を返す...

Random#rand(range) -> Integer | Float (157.0)

一様な擬似乱数を発生させます。

...が存在しない範囲を渡した時などに発生します。

//emlist[例][ruby]{
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand # => 0.1915194503788923
srand(1234)
rand # => 0.1915194503788923

# max に実数も指定出来る
prng...
...
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
require 'date'
prng.rand(Date.new(2012, 1, 1) ... Date.new(2013,1,1)) # => #<Date: 2012-01-31 ((2455958j,0s,0n),+0s,2299161j)>
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand...
...3.6148130397862865
# 2012年のすべての時刻から一つ選ばれる
# Time#- は秒数を float で返すため。
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
# DateTime ではうまくいかない。というのは DateTime#- は
# Rational を返す...

Regexp#options -> Integer (150.0)

正規表現の生成時に指定されたオプションを返します。戻り値は、 Regexp::EXTENDED, Regexp::IGNORECASE, Regexp::MULTILINE, Regexp::FIXEDENCODING, Regexp::NOENCODING, の論理和です。

...るもので、Regexp.new にこれらを
渡しても無視されます。

//emlist[例][ruby]{
p Regexp::IGNORECASE # => 1
p //i.options # => 1

p Regexp.new("foo", Regexp::IGNORECASE ).options # => 1
p Regexp.new("foo", Regexp::EXTENDED).options # => 2
p Regexp.new("foo", Regexp::IGNOR...
...ASE | Regexp::EXTENDED).options # => 3
p Regexp.new("foo", Regexp::MULTILINE).options # => 4
p Regexp.new("foo", Regexp::IGNORECASE | Regexp::MULTILINE ).options # => 5
p Regexp.new("foo", Regexp::MULTILINE | Regexp::EXTENDED).options # =>6
p Regexp.new("foo", Regexp::IGNORECASE | Regexp::MULTILINE...

Time#wday -> Integer (144.0)

曜日を0(日曜日)から6(土曜日)の整数で返します。

...= Time.new(2017, 9, 17, 10, 34, 15, '+09:00') # => 2017-09-17 10:34:15 +0900
p sun.wday # => 0
p mon = Time.new(2017, 9, 18, 10, 34, 15, '+09:00') # => 2017-09-18 10:34:15 +0900
p mon.wday # => 1
p tue = Time.new(2017,...
...= Time.new(2017, 9, 20, 10, 34, 15, '+09:00') # => 2017-09-20 10:34:15 +0900
p wed.wday # => 3
p thu = Time.new(2017, 9, 21, 10, 34, 15, '+09:00') # => 2017-09-21 10:34:15 +0900
p thu.wday # => 4
p fri = Time.new(2017,...
...9, 22, 10, 34, 15, '+09:00') # => 2017-09-22 10:34:15 +0900
p fri.wday # => 5
p sat = Time.new(2017, 9, 23, 10, 34, 15, '+09:00') # => 2017-09-23 10:34:15 +0900
p sat.wday # => 6
//}...

絞り込み条件を変える

<< 1 2 3 ... > >>