관리-도구
편집 파일: rand-i.yaml
--- !ruby/object:RI::MethodDescription aliases: [] block_params: comment: - !ruby/struct:SM::Flow::P body: Converts <em>max</em> to an integer using max1 = max<tt>.to_i.abs</tt>. If the result is zero, returns a pseudorandom floating point number greater than or equal to 0.0 and less than 1.0. Otherwise, returns a pseudorandom integer greater than or equal to zero and less than max1. <tt>Kernel::srand</tt> may be used to ensure repeatable sequences of random numbers between different runs of the program. Ruby currently uses a modified Mersenne Twister with a period of 2**19937-1. - !ruby/struct:SM::Flow::VERB body: " srand 1234 #=> 0\n [ rand, rand ] #=> [0.191519450163469, 0.49766366626136]\n [ rand(10), rand(1000) ] #=> [6, 817]\n srand 1234 #=> 1234\n [ rand, rand ] #=> [0.191519450163469, 0.49766366626136]\n" full_name: Kernel#rand is_singleton: false name: rand params: | rand(max=0) => number visibility: public