summaryrefslogtreecommitdiff
path: root/userspace/test-math.c
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-08-17 03:57:35 +0200
committerMiguel <m.i@gmx.at>2018-08-17 03:57:35 +0200
commit413f1f19184acd9024b9a97156c467b88ff72484 (patch)
treefcc8ba0a4ea8a1785d5818c7793e946da84e07e6 /userspace/test-math.c
parentc742be9c738c91703a7be787639cad167de3a6b1 (diff)
math, time, seed and randomness - simple test
Diffstat (limited to 'userspace/test-math.c')
-rw-r--r--userspace/test-math.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/userspace/test-math.c b/userspace/test-math.c
new file mode 100644
index 0000000..acaecad
--- /dev/null
+++ b/userspace/test-math.c
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <math.h>
+#include <time.h>
+
+int main(int argc, char **argv)
+{
+ time_t ltime;
+ time(&ltime);
+ printf("the time is %s", ctime(&ltime));
+
+ unsigned int seed=time(NULL);
+ printf("seed = %u\n",seed);
+
+ srand(seed);
+
+ for(int i=0;i<10;i++)
+ {
+ int r=rand()%100;
+ printf("sin(%i) = %f \n",r,sin(r));
+ }
+
+
+ return 0;
+}
+
+
+
+
+