Ver código fonte

Lua : initialize math random seed with current timestamp

Justin Donaldson 9 anos atrás
pai
commit
7d387963bd
1 arquivos alterados com 3 adições e 0 exclusões
  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());
 }
 }