in reply to Re: Remove lowest number
in thread Remove lowest number

Uhh ... Musky? ellem was making all 1's into 2's. Your code doesn't do that. :-)

------
We are the carpenters and bricklayers of the Information Age.

The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Replies are listed 'Best First'.
Re: Re: Re: Remove lowest number
by Mr. Muskrat (Canon) on Aug 06, 2003 at 15:55 UTC

    I know :-)
    I don't use "fixed" dice.

      Sadly this was done because I couldn't figure out a way to reroll 1s.

      (you can see it but I filled with shame)
      --
      ellem@optonline.net
      There's more than one way to do it, but only some of them actually work.
        my $onetosix = int(rand(6) + 1);

        rand will take its argument, and return a number somewhere between 0 and n-1 (0 -> 5 in this case). Actually it will return, though I'm not sure to what decimal depth, a random fractional number (0.0* -> 5.9*). Applying int() to the result causes it to round the fractional to a whole number. Then we add one.

        use perl;