aboutsummaryrefslogtreecommitdiff
path: root/src/pattern_sim.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-11-14 14:59:53 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:05 +0100
commit1f0da065385e1345f1201e6c1130adcc0bdcb6fe (patch)
tree542cef9104653abf19f1b2e68251f9858732b4ce /src/pattern_sim.c
parent49004f0cc3a573e8a866e0e999c138732683b99f (diff)
pattern_sim: Make random numbers really random
Diffstat (limited to 'src/pattern_sim.c')
-rw-r--r--src/pattern_sim.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/pattern_sim.c b/src/pattern_sim.c
index a1c72ef4..bcbefdf5 100644
--- a/src/pattern_sim.c
+++ b/src/pattern_sim.c
@@ -273,6 +273,16 @@ int main(int argc, char *argv[])
}
+ /* FIXME: Make this optional */
+ if ( 1 ) {
+ FILE *fh;
+ unsigned int seed;
+ fh = fopen("/dev/urandom", "r");
+ fread(&seed, sizeof(seed), 1, fh);
+ fclose(fh);
+ srand(seed);
+ }
+
if ( filename == NULL ) {
filename = strdup("molecule.pdb");
}