ソースを参照

[lua] add arguments and docs to the Math.random* functions

Dan Korostelev 8 年 前
コミット
a60bee7ad9
1 ファイル変更14 行追加2 行削除
  1. 14 2
      std/lua/Math.hx

+ 14 - 2
std/lua/Math.hx

@@ -37,7 +37,19 @@ extern class Math {
 	public static function max  (i : Float, j :Float) : Float;
 	public static function min  (i : Float, j :Float) : Float;
 
-	public static function random() : Float;
-	public static function randomseed(i : Float) : Float;
+	/**
+		This function is an interface to the simple pseudo-random generator function rand provided by ANSI C.
+		(No guarantees can be given for its statistical properties.)
+
+		When called without arguments, returns a uniform pseudo-random real number in the range [0,1).
+		When called with an integer number `m`, returns a uniform pseudo-random integer in the range [1, m].
+		When called with two integer numbers `m` and `n`, returns a uniform pseudo-random integer in the range [m, n].
+	**/
+	public static function random(?m:Float, ?n:Float) : Float;
+
+	/**
+		Sets `x` as the "seed" for the pseudo-random generator: equal seeds produce equal sequences of numbers.
+	**/
+	public static function randomseed(x : Float) : Float;
 }