Skip to content

Commit e663600

Browse files
committed
Runtime: conditionnal implem for caml_sys_random_seed
1 parent f8a72e5 commit e663600

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

runtime/stdlib.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -834,13 +834,23 @@ function caml_sys_get_config () {
834834
return [0, caml_new_string("Unix"), 32, 0];
835835
}
836836
//Provides: caml_sys_random_seed mutable
837+
//Version: < 4.00
837838
//The function needs to return an array since OCaml 4.0...
838839
function caml_sys_random_seed () {
839840
var x = new Date()^0xffffffff*Math.random();
840-
var res = [0,x];
841-
res.valueOf = function(){return x};
842-
return res;
841+
return x;
843842
}
843+
844+
//Provides: caml_sys_random_seed mutable
845+
//Version: >= 4.00
846+
//The function needs to return an array since OCaml 4.0...
847+
function caml_sys_random_seed () {
848+
var x = new Date()^0xffffffff*Math.random();
849+
return [0,x];
850+
}
851+
852+
853+
844854
//Provides: caml_sys_const_big_endian const
845855
function caml_sys_const_big_endian () { return 0; }
846856
//Provides: caml_sys_const_word_size const

0 commit comments

Comments
 (0)