| Re: produce a uniformly distributed random integer in the range |
|
 |
|
 |
|
 |
|
 |
Group: comp.softsys.sas · Group Profile
Author: Kevin VielKevin Viel Date: Sep 22, 2008 21:12
On Mon, 22 Sep 2008 08:21:42 -0700, Pardee, Roy GHC.ORG> wrote:
>I need to generate a random integer that falls in the range (-x) and (x)
and am finding it suprisingly difficult. The below code works well in
terms of staying w/in the desired range, but when you look at the freqs,
the 2 extreme values only occur at half the rate of the other values.
>
>I suspect the culprit is the round() function, but don't know how to fix.
Does anybody have this code handy?
Roy,
You have had several suggestions, some of which have appealed to you, so
I won't add one. Let me just point out that in caliper matching, you may
have introduce a bias. It might be worth considering definitive ranges,
like 1 - 6 months versus plus/minus 3 months...
Kevin
|