summaryrefslogtreecommitdiff
path: root/gsl-1.9/doc/examples/rngunif.c
diff options
context:
space:
mode:
Diffstat (limited to 'gsl-1.9/doc/examples/rngunif.c')
-rw-r--r--gsl-1.9/doc/examples/rngunif.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gsl-1.9/doc/examples/rngunif.c b/gsl-1.9/doc/examples/rngunif.c
new file mode 100644
index 0000000..ca4b2db
--- /dev/null
+++ b/gsl-1.9/doc/examples/rngunif.c
@@ -0,0 +1,26 @@
+#include <stdio.h>
+#include <gsl/gsl_rng.h>
+
+int
+main (void)
+{
+ const gsl_rng_type * T;
+ gsl_rng * r;
+
+ int i, n = 10;
+
+ gsl_rng_env_setup();
+
+ T = gsl_rng_default;
+ r = gsl_rng_alloc (T);
+
+ for (i = 0; i < n; i++)
+ {
+ double u = gsl_rng_uniform (r);
+ printf ("%.5f\n", u);
+ }
+
+ gsl_rng_free (r);
+
+ return 0;
+}