From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5291fa0ea59b8b29 X-Google-Attributes: gid103376,public From: geert@fozzie.sun3.iaf.nl (Geert Bosch) Subject: Re: Random Number Generation Date: 1996/10/12 Message-ID: <53o3ot$han@fozzie.sun3.iaf.nl>#1/1 X-Deja-AN: 189102407 references: <53jgrh$r20@newton.cc.rl.ac.uk> organization: La Calandre Infortunee newsgroups: comp.lang.ada Date: 1996-10-12T00:00:00+00:00 List-Id: I wrote: `` This is not a simple example. It is not possible to write an Ada program that does convert R1 to R2 and is guaranteed to finish in finite time. '' Dr J Parker (jp3@rl.ac.uk) responded: `` Nah... the rejection method is rigorously correct, and so is the subsequent use of x rem 3 in the code fragment below. '' I don't say it is not possible to present a correct algorithm to convert R1 to R2. Such a correct algorithm just is not guaranteed to finish in finite time. Your algorithm: `` x := random; while x > R1'Last - 1024 rem 3 loop x := random; end loop; return x rem 3; '' You can't give an upper boundary for the number of iterations of the while loop if R1 is a truly random generator. Of course in practise you're only interested in having an algorithm that has a good probability to finish in a certain amount of time. I just pointed out that the example wasn't that simple. Somebody using this code should be aware of that. Regards, Geert -- E-Mail: geert@sun3.iaf.nl ``I think there is a world market for maybe five computers.'' Thomas Watson, chairman of IBM, 1943