Revision cf809dc3bfb8f1b6a301a061dc69168e7788b5a4 authored by Paul Zimmermann on 14 February 2014, 20:44:09 UTC, committed by Paul Zimmermann on 14 February 2014, 20:44:09 UTC
2 parent s 8fdab5a + 093cf82
Raw File
test-rand.c
#include <stdio.h>
#include <stdlib.h>

int
main ()
{
  int i, v, count[2];

  srand (0);
  count[0] = count[1] = 0;
  for (i = 0; i < 1000; i++)
    {
      v = (rand () + i) & 1;
      count[v] ++;
    }
  if (count[0] == 0 || count[1] == 0)
    {
      printf ("bad random generator\n");
      return 1;
    }
  return 0;
}
back to top