Ruby 1.9.3 リファレンスマニュアル > ライブラリ一覧 > securerandomライブラリ > SecureRandomモジュール > uuid

singleton method SecureRandom.uuid

uuid -> String

バージョン 4 の UUID (Universally Unique IDentifier) を生成して返します。

version 4 の UUID は全くランダムです (バージョンを除いて)。 この UUID は MAC アドレスや時刻などのような意味のある情報を含みません。

[EXCEPTION] NotImplementedError:
安全な乱数発生器が使えない場合に発生します。
p SecureRandom.uuid #=> "2d931510-d99f-494a-8c67-87feb05e1594"
p SecureRandom.uuid #=> "62936e70-1815-439b-bf89-8492855a7e6b"

[SEE_ALSO] [RFC4122]

module SecureRandom