@@ -12,6 +12,7 @@
php : fixed local vars with certain names (_SERVER, _GET etc) overriding super global values (#9924)
macro : added return type hint to haxe.macro.MacroStringTools.formatString (#9928)
cs : fixed catching exceptions from static closures (#9957)
+ eval : fixed `Std.random(arg)` for `arg` values of more than 30 bits (#9974)
2020-09-11 4.1.4:
@@ -2198,8 +2198,8 @@ module StdStd = struct
)
let random = vfun1 (fun v ->
- let v = decode_int v in
- vint (Random.State.int random (if v <= 0 then 1 else v))
+ let v = decode_i32 v in
+ vint32 (Random.State.int32 random (if v <= Int32.zero then Int32.one else v))
);
end
@@ -0,0 +1,10 @@
+package unit.issues;
+
+class Issue9974 extends unit.Test {
+#if !neko
+ function test() {
+ var r = Std.random(0x7FFFFFFF);
+ t(r >= 0);
+ }
+#end
+}