[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to generate random negative numbers



On Wed, 12 Aug 2009 15:26:06 -0500
"Boyd Stephen Smith Jr." <bss@iguanasuicide.net> wrote:

...

> $RANDOM gives a random number.  It has a relatively large range, I think 
> 0-32K maybe even larger.

...

> Examples:
> echo $((RANDOM % 6 + 1)) # Rolls a "normal" die[1].

...

> [1] But not a fair one.  If the $RANDOM function is completely random, so 
> that over the "long tail" all values show up with the same frequency, the 
> die will be slightly biased low.

Do you mean that it will be biased low since the range (presumably)
doesn't end on a number of the form 6n-1, or something else?

Celejar
-- 
mailmin.sourceforge.net - remote access via secure (OpenPGP) email
ssuds.sourceforge.net - A Simple Sudoku Solver and Generator


Reply to: