Random number challenge

Peter McNabb peter at mcnabbs.org
Wed Jun 11 22:53:17 MDT 2008

On Wed, Jun 11, 2008 at 09:10:00PM -0600, Wade Preston Shearer wrote:
>This comes up every month at PLUG (for door prizes) so I thought I'd  
>ask here.  What's an easy to remember way to generate a random  
>number between 1 and some given number.  Language doesn't matter so  
>long as the code is easy enough for someone to remember the entire  
>thing and type it up at the drop of a hat.

how about in bash? what, you didn't know bash had a built-in $RANDOM function? 

echo $[$RANDOM % 100 + 1]


More information about the PLUG mailing list