Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /smlnj-lib/releases/release-110.61/Util/rand-sig.sml
ViewVC logotype

Annotation of /smlnj-lib/releases/release-110.61/Util/rand-sig.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2253 - (view) (download)

1 : monnier 2 (* rand-sig.sml
2 :     *
3 : monnier 29 * COPYRIGHT (c) 1993 by AT&T Bell Laboratories. See COPYRIGHT file for details.
4 :     * COPYRIGHT (c) 1998 by AT&T Laboratories.
5 : monnier 2 *
6 :     * Signature for a simple random number generator.
7 :     *
8 :     *)
9 :    
10 :     signature RAND =
11 :     sig
12 :    
13 : monnier 29 type rand = Word31.word
14 :    
15 :     val randMin : rand
16 :     val randMax : rand
17 :    
18 :     val random : rand -> rand
19 : monnier 2 (* Given seed, return value randMin <= v <= randMax
20 :     * Iteratively using the value returned by random as the
21 :     * next seed to random will produce a sequence of pseudo-random
22 :     * numbers.
23 :     *)
24 :    
25 : monnier 29 val mkRandom : rand -> unit -> rand
26 : monnier 2 (* Given seed, return function generating a sequence of
27 :     * random numbers randMin <= v <= randMax
28 :     *)
29 :    
30 : monnier 29 val norm : rand -> real
31 :     (* Map values in the range [randMin,randMax] to (0.0,1.0) *)
32 : monnier 2
33 : monnier 29 val range : (int * int) -> rand -> int
34 :     (* Map v, randMin <= v <= randMax, to integer range [i,j]
35 : monnier 2 * Exception -
36 : monnier 29 * Fail if j < i
37 : monnier 2 *)
38 :    
39 :     end (* RAND *)
40 : monnier 29

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0