Commit 3ed670b2 authored by Evgeniy Isaev's avatar Evgeniy Isaev Committed by Mouse

Added check for `random()` function availability

parent 276c959b
......@@ -285,6 +285,7 @@ AC_CHECK_FUNCS(strtoimax strtoll)
AC_CHECK_FUNCS(mergesort)
AC_CHECK_FUNCS(mkstemps)
AC_CHECK_FUNCS(timegm)
AC_CHECK_FUNCS(random)
AC_CHECK_DECLS(strcasecmp)
AC_CHECK_DECLS(vasprintf)
AC_TRY_LINK_FUNC([symlink],[AC_DEFINE([HAVE_SYMLINK], 1, [Define to 1 if you have the symlink function.])])
......
......@@ -49,7 +49,11 @@ asn_random_between(intmax_t lb, intmax_t rb) {
for(; got_entropy < range;) {
got_entropy = (got_entropy << 24) | 0xffffff;
#ifdef HAVE_RANDOM
value = (value << 24) | (random() % 0xffffff);
#else
value = (value << 24) | (rand() % 0xffffff);
#endif
}
return lb + (intmax_t)(value % (range + 1));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment