Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1823 for code/trunk


Ignore:
Timestamp:
Sep 22, 2008, 6:42:39 PM (16 years ago)
Author:
landauf
Message:

small change in Math.h: rnd not going anymore from 0 to 1 but from 0 until 1.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/util/Math.h

    r1791 r1823  
    216216
    217217/**
    218     @brief Returns a random number between 0 and 1.
     218    @brief Returns a random number between 0 and almost 1: 0 <= rnd < 1.
    219219*/
    220220inline _UtilExport float rnd()
    221221{
    222     return ((float)rand() / RAND_MAX);
    223 }
    224 
    225 /**
    226     @brief Returns a random number between 0 and max.
     222    return ((float)rand() / (RAND_MAX + 1));
     223}
     224
     225/**
     226    @brief Returns a random number between 0 and almost max: 0 <= rnd < max.
    227227    @param max The maximum
    228228*/
     
    233233
    234234/**
    235     @brief Returns a random number between min and max.
     235    @brief Returns a random number between min and almost max: min <= rnd < max.
    236236    @param min The minimum
    237237    @param max The maximum
Note: See TracChangeset for help on using the changeset viewer.