Skip to content

Instantly share code, notes, and snippets.

@tai2
Created March 27, 2013 06:31
Show Gist options
  • Select an option

  • Save tai2/5252186 to your computer and use it in GitHub Desktop.

Select an option

Save tai2/5252186 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int lcg() {
static int seed = 8;
seed = (1664525 * seed + 1013904223) & 2147483647;
return seed;
}
int
main() {
int i;
for (i = 0; i < 300; i++) {
printf("%d ", lcg());
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment