We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cac71d1 commit 02a3b61Copy full SHA for 02a3b61
1 file changed
src/libasr/runtime/lfortran_intrinsics.c
@@ -1884,13 +1884,22 @@ LFORTRAN_API double _lfortran_time()
1884
#endif
1885
}
1886
1887
+bool lfortran_rand_seed = true;
1888
LFORTRAN_API void _lfortran_sp_rand_num(float *x) {
- srand(time(0));
1889
+ if (lfortran_rand_seed) {
1890
+ srand((unsigned int)clock());
1891
+ rand();
1892
+ lfortran_rand_seed = false;
1893
+ }
1894
*x = rand() / (float) RAND_MAX;
1895
1896
1897
LFORTRAN_API void _lfortran_dp_rand_num(double *x) {
1898
1899
1900
1901
1902
1903
*x = rand() / (double) RAND_MAX;
1904
1905
0 commit comments