Integrated crypto

Robert Connolly cendres at videotron.ca
Thu Apr 1 06:33:32 PST 2004


Anyway. This is an example in http://www.xs4all.nl/~hanb/software/
arc4random.tar.bz2

#include <stdlib.h>
 int main(void) {
     int byte1, byte2, byte3;
         byte1 = random() % 256;
         byte2 = random() % 256;
         byte3 = random() % 256;
         printf("#%02x%02x%02x\n", byte1, byte2, byte3);
  }

random() can be replaced with rand() too. The output from this is not random, 
its the same over and over. Why isn't rand() random?




More information about the hlfs-dev mailing list