JavaTM 2 Platform
Standard Ed. 6

類別 java.util.Random
的使用

使用 Random 的軟體套件
java.math 提供用於執行任意精度整數演算法 (BigInteger) 和任意精度小數演算法 (BigDecimal) 的類別。 
java.security 為安全框架提供類別和介面。 
java.util 包含 collection 框架、遺留的 collection 類別、事件模型、日期和時間設施、國際化和各種實用工具類別(字元串標記產生器、隨機數產生器和位元陣列)。 
 

java.math 中 Random 的使用
 

參數型別為 Random 的 java.math 中的方法
static BigInteger BigInteger.probablePrime(int bitLength, Random rnd)
          返回有可能是素數的、具有指定長度的正 BigInteger。
 

參數型別為 Random 的 java.math 中的建構子
BigInteger(int bitLength, int certainty, Random rnd)
          建構一個隨機產生的正 BigInteger,它可能是一個具有指定 bitLength 的素數。
BigInteger(int numBits, Random rnd)
          建構一個隨機產生的 BigInteger,它是在 0 到 (2numBits - 1)(包括)範圍內均勻分佈的值。
 

java.security 中 Random 的使用
 

java.security 中 Random 的子類別
 class SecureRandom
          此類別提供強加密隨機數產生器 (RNG)。
 

java.util 中 Random 的使用
 

參數型別為 Random 的 java.util 中的方法
static void Collections.shuffle(List<?> list, Random rnd)
          使用指定的隨機源對指定列表進行置換。
 


JavaTM 2 Platform
Standard Ed. 6

提交錯誤或意見

版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。