Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 50 lines (39 sloc) 1.384 kb
fccc685 Initial open-source release
MLstate authored
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18 (* CF mli *)
19
20 include Random
21
22 let ensure_init =
23 let random_self_init = ref false in
24 fun () -> if not !random_self_init then begin
25 random_self_init := true;
26 self_init ();
27 end
28
29 let max_int () = Nativeint.to_int (Random.nativeint (Nativeint.of_int max_int))
30 let max_int64 () = int64 Int64.max_int
31
32 let string len =
33 let s = String.create len in
34 for i = 0 to len - 1 do
35 s.[i] <- Char.chr (int 128);
36 done;
37 s
38
39 let abstract_string alphabet len =
40 let apha_len = String.length alphabet in
41 let s = String.create len in
42 for i = 0 to len - 1 do
43 let x = int apha_len in
44 s.[i] <- alphabet.[x];
45 done;
46 s
47
48 let alpha_string len =
49 abstract_string "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" len
Something went wrong with that request. Please try again.