Library/C Runtime/ranged rand

From Rosetta Code
< Library/C Runtime
Revision as of 18:24, 16 December 2012 by rosettacode>Mighty Cat
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
   #include <cstdlib>
   
   ...
   
   int rangedRand(int min, int max)
   {
       return rand() % (max - min + 1) + min;
   }