Revision 04d936b111068ed0247613675a3c458b6b5feb5b authored by Alexander Kruppa on 19 February 2014, 14:03:37 UTC, committed by Alexander Kruppa on 19 February 2014, 14:03:37 UTC
1 parent 869d21a
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