返回列表 發帖

亂數 (一)

運用 random() 函式, 產生一範圍介於 0.00000 (趨近於0) ~ 0.99999 (趨近於1) 之隨機亂數.
用此語法產生的亂數, 其資料形態為 double.
  1. public static void main(String args[])
  2.     {
  3.         double r;
  4.         r=Math.random();
  5.         System.out.println(r);
  6.     }
複製代碼

返回列表