MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Testing a random integer generator (Answered)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg130391] Re: Testing a random integer generator (Answered)
  • From: Clif McInnis <c_mcinnis at hotmail.com>
  • Date: Mon, 8 Apr 2013 00:04:56 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <kjqjln$37o$1@smc.vnet.net>

I had gotten a message that the post had taken too long to upload, so I thought that it was not here. I found  a way to make the "test" work and got the results that I expected. In the event that anyone else would be interest
ed the code that I used is as follows:

Peace -- Clif

Initialization /.
 Initialization :> {x = 0, p = 0, q = 0, mne = 0, mnn = 0, lte = 0,
   ltn = 0}
While[x < 100000, {
  Clear[p, q],
  q = RandomInteger[{1, 4}], If[q < 4,
   {p = RandomInteger[{10, 20}],
    q = RandomInteger[],
    If[q == 1, q = p, q = RandomInteger[{10, 20}]]}, {p =
     RandomInteger[{1, 9}],
    q = RandomInteger[],
    If[q == 1, q = p, q = RandomInteger[{1, 9}]]}],(*Print[p," and ",
  q],*)
  If [p >
    9, {If[p == q, mne += 1, mnn += 1]}, {If[p == q, lte += 1,
     ltn += 1]}]}; x++]; Print[mne/x, Space[10], mnn/x, Space[10],
 lte/x, Space[10], ltn/x
 ]



  • Prev by Date: Re: rayshade POV Export help asked
  • Next by Date: Re: Not-understandable warning
  • Previous by thread: Re: Testing a random integer generator
  • Next by thread: Simplify an expression with respect to one of many variables