[sf-perl] Thinking about psuedo-randomness

Randal L. Schwartz merlyn at stonehenge.com
Sun Mar 29 19:03:26 PDT 2009

>>>>> "Joe" == Joe Brenner <doom at kzsu.stanford.edu> writes:

Joe> Josh Berkus <josh at agliodbs.com> wrote:

>> I've been thinking a little about the pseudo-randomness issue some, and
>> I think there *is* a generalizable case.  However, can you send me your
>> slides/code so that I can build on what you have rather than starting
>> from scratch?

Joe> Here's the slides:

Joe>   http://obsidianrook.com/devnotes/talks/esthetic_randomness/

the code in
      $tweak = $downers/$uppers;
      $uppity = int( rand(1 + $tweak) );

has a biased bias.  I think what you wanted is:

$uppity = rand($uppers + $downers) > $uppers;

Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

More information about the SanFrancisco-pm mailing list