Re: [Caml-list] Random questions

2009-12-03 Thread AUGER
Le Thu, 03 Dec 2009 17:01:18 +0100, Damien Doligez a écrit: On 2009-12-03, at 12:00, AUGER wrote: (* preliminary function: negate_minus_1 : int -> int : n |-> -n-1 *) let negate_minus_1 = (lor) (-(max_int/2)-1) (* or inline the constant *) You probably mean this: let negate_minus_1

Re: [Caml-list] Random questions

2009-12-03 Thread Damien Doligez
On 2009-12-03, at 12:00, AUGER wrote: (* preliminary function: negate_minus_1 : int -> int : n |-> -n-1 *) let negate_minus_1 = (lor) (-(max_int/2)-1) (* or inline the constant *) You probably mean this: let negate_minus_1 = (lxor) (-1);; -- Damien

Re: [Caml-list] Random questions

2009-12-03 Thread AUGER
Le Thu, 03 Dec 2009 15:48:37 +0100, Daniel Bünzli a écrit: Hello Cedric, Thanks for your comments. Comments on your comments. let rint () = (Random.bits () lsl 1) lxor (Random.bits ());; That was actually my first version. However I dropped it because I thought that generating a new rand

Re: [Caml-list] Random questions

2009-12-03 Thread Daniel Bünzli
Hello Cedric, Thanks for your comments. Comments on your comments. > let rint () = (Random.bits () lsl 1) lxor (Random.bits ());; That was actually my first version. However I dropped it because I thought that generating a new random number by the interaction of the bits of two successive PRN co

Re: [Caml-list] Random questions

2009-12-03 Thread AUGER
Le Wed, 18 Nov 2009 11:59:08 +0100, Daniel Bünzli a écrit: I know little about PRGN and unfortunately in a lot of cases the functions in the Random module don't provide me the right interface. Could anybody tell me if the following functions preserve the quality of the underlying PRGN and/or

[Caml-list] Random questions

2009-11-18 Thread Daniel Bünzli
I know little about PRGN and unfortunately in a lot of cases the functions in the Random module don't provide me the right interface. Could anybody tell me if the following functions preserve the quality of the underlying PRGN and/or if there's a better way to achieve that : 1) Generate an arbitra