Class Random

java.lang.Object
me.axolotl.api.tool.Random

public final class Random extends Object
Random類別提供了生成隨機數的方法。
Since:
2024-03-04
  • Constructor Details

    • Random

      public Random()
  • Method Details

    • randomAsInt

      public static int randomAsInt()
      生成一個隨機整數。
      Returns:
      一個隨機整數
    • randomAsLong

      public static long randomAsLong()
      生成一個隨機長整數。
      Returns:
      一個隨機長整數
    • randomAsDouble

      public static double randomAsDouble()
      生成一個隨機雙精度浮點數值。
      Returns:
      一個隨機雙精度浮點數值
    • randomAsFloat

      public static float randomAsFloat()
      生成一個隨機單精度浮點數值。
      Returns:
      一個隨機單精度浮點數值
    • between

      public static int between(int min, int max)
      生成指定範圍內的隨機整數。
      Parameters:
      min - 範圍的最小值(包括)
      max - 範圍的最大值(包括)
      Returns:
      指定範圍內的隨機整數