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
SOLUCIONES_TRABAJO_05
150108_recursividadFactorial
Undefined behavior
to upper case string
18BCE2182 ASSESS_1 Q1-6
A_141124_arrayMaxMin02
18BCE2182 ASSESS_1 Q2-2
Strncpy memcpy
3D NO SE XD
tgo