[Date Index]
[Thread Index]
[Author Index]
Testing a random integer generator
*To*: mathgroup at smc.vnet.net
*Subject*: [mg130387] Testing a random integer generator
*From*: Clif McInnis <c_mcinnis at hotmail.com>
*Date*: Sat, 6 Apr 2013 21:53:46 -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
I am trying to test the random integer generator in a program to make sure
that it gives the type of output that I am looking for. I expect it to generate (p<>q)<10 slightly less than 1/8 of the time and (p=q)<10 slightly more than 1/8 of the time, 9<(p<>q)<20 slightly less than 3/8 of the time, and 9<(p=q)<20 slightly more than 3/8 of the time. Regardless of my expectations I would like to see how the numbers actually come out, and to that end was attempting to test the test the code, but I can not get it to generate (print) any numbers. I am sure that I have made an error somewhere in the code, but I can not find it and am not getting any error messages. Thank you for any and all help.
Clif McInnis
Initialization :> ({x = 0, p = 0, q = 0})
While[x < 100, {
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],
Print[q]}; x++]
Prev by Date:
**Re: "Displaying" the meaning of zero**
Next by Date:
**Re: rayshade POV Export help asked**
Previous by thread:
** Re: Not-understandable warning**
Next by thread:
**Re: Testing a random integer generator**
| |