Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
linux (mostly) true random number generator
#include <stdio.h> #include <fcntl.h> #include <unistd.h> double trnd(void) { unsigned long n; int fd = open("/dev/urandom", O_RDONLY); read(fd, &n, 8); close(fd); double v = n / (double)~0UL; return v; } int main(void) { double m = 0; long v = 100000L; for (long a = 0; a < v; a++) { m += trnd(); } printf("%.20f\n", m/v); return 0; }
run
|
edit
|
history
|
help
1
2.3 Comparision with Matrix Multiplication Execution Time
some_tests
FileCat
Ordered Openmp
HW2A
sphere
Project 3 Part 1 v1.4
-Wfloat-conversion
Project 5 v.08
test