Ignore:
Timestamp:
Apr 18, 2006, 6:17:14 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Changed the cucul_rand() behaviour. Now cucul_rand(0, 10) returns random values between 0 and 9 (used to be 0 and 10). Updated documentation accordingly.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/test/dithering.c

    r813 r815  
    5555        /* distance to 40% */
    5656        dist = XRATIO * (x - 40) * (x - 40) + YRATIO * y * y;
    57         if(cucul_rand(-FUZZY, FUZZY) + dist < dista)
     57        if(cucul_rand(-FUZZY, FUZZY+1) + dist < dista)
    5858        {
    5959            nearb = neara; distb = dista; neara = 1; dista = dist;
     
    6666        /* check dist to 70% */
    6767        dist = XRATIO * (x - 70) * (x - 70) + YRATIO * y * y;
    68         if(cucul_rand(-FUZZY, FUZZY) + dist < dista)
     68        if(cucul_rand(-FUZZY, FUZZY+1) + dist < dista)
    6969        {
    7070            nearb = neara; distb = dista; neara = 2; dista = dist;
    7171        }
    72         else if(cucul_rand(-FUZZY, FUZZY) + dist < distb)
     72        else if(cucul_rand(-FUZZY, FUZZY+1) + dist < distb)
    7373        {
    7474            nearb = 2; distb = dist;
     
    7777        /* check dist to white */
    7878        dist = XRATIO * (x - 100) * (x - 100) + YRATIO * y * y;
    79         if(cucul_rand(-FUZZY, FUZZY) + dist < dista)
     79        if(cucul_rand(-FUZZY, FUZZY+1) + dist < dista)
    8080        {
    8181            nearb = neara; distb = dista; neara = 3; dista = dist;
    8282        }
    83         else if(cucul_rand(-FUZZY, FUZZY) + dist < distb)
     83        else if(cucul_rand(-FUZZY, FUZZY+1) + dist < distb)
    8484        {
    8585            nearb = 3; distb = dist;
     
    9090        dist = XRATIO * (x - 40) * (x - 40) + YRATIO * (y - 100) * (y - 100);
    9191        dist = dist * 12 / 16;
    92         if(cucul_rand(-FUZZY, FUZZY) + dist < dista)
     92        if(cucul_rand(-FUZZY, FUZZY+1) + dist < dista)
    9393        {
    9494            nearb = neara; distb = dista; neara = 4; dista = dist;
    9595        }
    96         else if(cucul_rand(-FUZZY, FUZZY) + dist < distb)
     96        else if(cucul_rand(-FUZZY, FUZZY+1) + dist < distb)
    9797        {
    9898            nearb = 4; distb = dist;
     
    102102        dist = XRATIO * (x - 100) * (x - 100) + YRATIO * (y - 100) * (y - 100);
    103103        dist = dist * 8 / 16;
    104         if(cucul_rand(-FUZZY, FUZZY) + dist < dista)
     104        if(cucul_rand(-FUZZY, FUZZY+1) + dist < dista)
    105105        {
    106106            nearb = neara; distb = dista; neara = 5; dista = dist;
    107107        }
    108         else if(cucul_rand(-FUZZY, FUZZY) + dist < distb)
     108        else if(cucul_rand(-FUZZY, FUZZY+1) + dist < distb)
    109109        {
    110110            nearb = 5; distb = dist;
Note: See TracChangeset for help on using the changeset viewer.