Random#new_seed():new_seed()是一種隨機類方法,它返回一個隨機種子值。
用法:Random.new_seed()
參數:隨機值
返回:隨機種子值
示例1:
# Ruby code for Random.new_seed() method
# declaring Random value
date_a = Random.new_seed()
# new arbitrary random value
puts "Random new_seed form : #{date_a}\n\n"
輸出:
Random new_seed form : 136900168362527727761982174954109934532
示例2:
# Ruby code for Random.new_seed() method
# declaring Random value
date_b = Random.new_seed()
# new arbitrary random value
puts "Random new_seed form : #{date_b}\n\n"
輸出:
Random new_seed form : 271255499858368204233299869842415724010
相關用法
- Ruby Random new()用法及代碼示例
- Scala Random ==()用法及代碼示例
- Ruby Random hex()用法及代碼示例
- Ruby Random srand()用法及代碼示例
- Ruby Random rand()用法及代碼示例
- Ruby Random random_bytes()用法及代碼示例
- Ruby Random urlsafe_base64()用法及代碼示例
- Ruby Random random_number()用法及代碼示例
- Ruby Random seed()用法及代碼示例
- Ruby Random uuid()用法及代碼示例
- Ruby Random base64()用法及代碼示例
- Ruby Random bytes()用法及代碼示例
- Ruby Set add?用法及代碼示例
注:本文由純淨天空篩選整理自mayank5326大神的英文原創作品 Ruby | Random new_seed() function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。