<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/rndTest.ml</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,37 @@
-let dichotomic_walk_seq arr =
-    let len = Array.length arr in
-    let s = Seq.dichotomy_int 0 len in
-    Seq.map (fun idx -&gt; arr.(idx)) (Seq.push_front 0 s)
+module Shuffle = struct
+
+    type 'a t = {
+        values: 'a array;
+        mutable pos: int;
+    }
+
+    let create values = {
+        values = Array.copy values;
+        pos = 0;
+    }
+
+    let _shuffle sh =
+        let len = Array.length sh.values in
+        if sh.pos &lt; len
+        then
+            begin
+            let idx = Random.int (len - sh.pos) in
+            let tmp = sh.values.(sh.pos + idx) in
+            sh.values.(sh.pos + idx) &lt;- sh.values.(sh.pos);
+            sh.values.(sh.pos) &lt;- tmp;
+            sh.pos &lt;- sh.pos + 1;
+            sh
+            end
+        else
+            failwith &quot;index error&quot;
+
+    let rec get sh idx =
+        if idx &lt; sh.pos
+        then
+            sh.values.(idx)
+        else
+            get (_shuffle sh) idx
+
+end (* module Shuffle *)
+
+</diff>
      <filename>rnd.ml</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>9f42c423a57c45be0951b0fdbb8bd2781b71bb54</id>
    </parent>
  </parents>
  <author>
    <name>Ludovic Coquelle</name>
    <email>lcoquelle@gmail.com</email>
  </author>
  <url>http://github.com/khigia/ocaml-anneal/commit/b6694fa23d81626079c0de2e2fa30a4147248582</url>
  <id>b6694fa23d81626079c0de2e2fa30a4147248582</id>
  <committed-date>2008-06-17T18:10:33-07:00</committed-date>
  <authored-date>2008-06-17T18:10:33-07:00</authored-date>
  <message>Added Rnd.Shuffle: shuffle with random access (based on array) and lazy property: shuffle only elements if accessed (not using Lazy to provide easy random access).</message>
  <tree>1c48ce0a434fa7cb3c63fbdc51850af9e07515af</tree>
  <committer>
    <name>Ludovic Coquelle</name>
    <email>lcoquelle@gmail.com</email>
  </committer>
</commit>
