Changeset 2324 for zzuf


Ignore:
Timestamp:
May 17, 2008, 12:01:07 AM (12 years ago)
Author:
Sam Hocevar
Message:
  • Improve overall randomness. Now even close seeds have very different behaviours on which bits are flipped.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/fuzz.c

    r2272 r2324  
    3737#define MAGIC1 0x33ea84f7
    3838#define MAGIC2 0x783bc31f
     39#define MAGIC3 0x9b5da2fb
    3940
    4041/* Fuzzing mode */
     
    106107        if(fuzz->cur != (int)i)
    107108        {
    108             uint32_t chunkseed = ((int)i + (int)(fuzz->ratio * MAGIC1)) ^ MAGIC2;
    109             _zz_srand(fuzz->seed ^ chunkseed);
     109            uint32_t chunkseed;
     110
     111            chunkseed = (uint32_t)i;
     112            chunkseed ^= MAGIC2;
     113            chunkseed += (uint32_t)(fuzz->ratio * MAGIC1);
     114            chunkseed ^= fuzz->seed;
     115            chunkseed += (uint32_t)(i * MAGIC3);
     116
     117            _zz_srand(chunkseed);
    110118
    111119            memset(fuzz->data, 0, CHUNKBYTES);
Note: See TracChangeset for help on using the changeset viewer.