|
From: Vesa K. <ve...@ml...> - 2007-01-12 04:33:19
|
Initial commit of a lib of misc utils to be refactored. ---------------------------------------------------------------------- A mltonlib/trunk/com/ssh/misc-util/unstable/ranqd1-gen.sml ---------------------------------------------------------------------- Added: mltonlib/trunk/com/ssh/misc-util/unstable/ranqd1-gen.sml =================================================================== --- mltonlib/trunk/com/ssh/misc-util/unstable/ranqd1-gen.sml 2007-01-12 12:32:59 UTC (rev 5047) +++ mltonlib/trunk/com/ssh/misc-util/unstable/ranqd1-gen.sml 2007-01-12 12:33:12 UTC (rev 5048) @@ -0,0 +1,24 @@ +(* Copyright (C) 2007 SSH Communications Security, Helsinki, Finland + * + * This code is released under the MLton license, a BSD-style license. + * See the LICENSE file or http://mlton.org/License for details. + *) + +(* + * A quick-and-dirty random generator. + *) + +structure RanQD1Gen :> sig + include RANDOM_GEN + val make : Word32.t -> t +end = struct + structure G = + MkRandomGen + (type t = Word32.t + val (value, seed) = Iso.<--> (Iso.swap Word.isoLarge, Word32.isoLarge) + val next = Misc.ranqd1 + fun split w = #2 o Misc.psdes /> seed w + val maxValue = value Word32.maxWord) + open G + val make = id +end Property changes on: mltonlib/trunk/com/ssh/misc-util/unstable/ranqd1-gen.sml ___________________________________________________________________ Name: svn:eol-style + native |