Răsfoiți Sursa

Lua : initialize math random seed with current timestamp

Justin Donaldson 9 ani în urmă
părinte
comite
7d387963bd
1 a modificat fișierele cu 3 adăugiri și 0 ștergeri
  1. 3 0
      std/lua/Math.hx

+ 3 - 0
std/lua/Math.hx

@@ -39,5 +39,8 @@ extern class Math {
 
 
 	public static function random() : Float;
 	public static function random() : Float;
 	public static function randomseed(i : Float) : Float;
 	public static function randomseed(i : Float) : Float;
+
+	//  initialize the random seed with the current time
+	public static function __init__() : Void randomseed(Os.time());
 }
 }