Re: Random numbers



On Fri, 21 Dec 2007 10:37:17 -0800 (PST), bill <b92057@xxxxxxxxx>
wrote:

On Dec 21, 3:16 am, John <iamach...@xxxxxxxxx> wrote:
Given a function that returns a random number between 1-5, write one
that returns a random number between 1-7 for the case when it should
be integer and for the case it can be real.

Let S be the function that generates a RN between 1 and 5. Then

T = S_1 + S_2 + ... + S_7

For the reals , RN_7 = T/7
For intgers, RN_7 = T mod 7

For one thing, T mod 7 can be 0, which is not even in the correct
range. But even ignoring that, if you were trying to create generators
which produce uniformly distributed (pseudo) random numbers, you
failed.

quasi
.



Relevant Pages

  • Re: Even Periods in Fermats Last Theorem and Modular Arithmetic (FLTMA)
    ... especially for those valuable generators of long period. ... theory of these composite generators is less well developed, ... You have my sincere thanks for your comments, quasi. ...
    (sci.math)
  • Re: random_number
    ... James Giles wrote in message ... ... >> each mantissa are printed. ... >Most random number generators return values in the ... Ideally, yes, but in practice, they are pseudo ...
    (comp.lang.fortran)
  • Re: Random Number Generation -----> Hardware or Software?
    ... > Ada has some requirements on the built-in (pseudo) random number ... But those requirements still don't get you a PRNG that you'd want to ... Offhand I don't recall whether the simple linear congruential generators ...
    (comp.arch.embedded)
  • Re: Ideals in R[x1,x2,...xN]
    ... Bill Dubuque wrote: ... quasi wrote: ... of generators to begin with, but once past that, the rest is ... This assumes the original set was already denumerated in some way. ...
    (sci.math)
  • Re: -- finitely presented groups on n generators
    ... (Arturo Magidin) ... quasi wrote: ... if G can be shown to have m generators, where m < n, then G can be ... a finite presentation in m generators. ...
    (sci.math)

Quantcast