summaryrefslogtreecommitdiffstats
path: root/sources/fabrice/pacemaker/genrand.ml
diff options
context:
space:
mode:
Diffstat (limited to 'sources/fabrice/pacemaker/genrand.ml')
-rw-r--r--sources/fabrice/pacemaker/genrand.ml27
1 files changed, 27 insertions, 0 deletions
diff --git a/sources/fabrice/pacemaker/genrand.ml b/sources/fabrice/pacemaker/genrand.ml
new file mode 100644
index 0000000..718762f
--- /dev/null
+++ b/sources/fabrice/pacemaker/genrand.ml
@@ -0,0 +1,27 @@
+open BigEndian
+
+let _ =
+ Printf.printf "genrand <filename> <nrandom>\n%!"
+
+let filename = Sys.argv.(1)
+let n = Int64.of_string Sys.argv.(2)
+
+let block = 4096
+let blockL = Int64.of_int block
+
+let _ =
+ let bound = 1 lsl 29 in
+ let oc = open_out filename in
+ let s = String.create (4 * block) in
+ let nblocks = Int64.to_int (Int64.div n blockL) + 1 in
+ for i = 1 to nblocks do
+ for x = 0 to block - 1 do
+
+ str_int s (x*4) (Random.int bound)
+
+ done;
+ output_string oc s
+
+ done;
+ close_out oc
+ \ No newline at end of file