summary refs log tree commit diff
path: root/src/tool
diff options
context:
space:
mode:
Diffstat (limited to 'src/tool')
-rw-r--r--src/tool/tool.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tool/tool.c b/src/tool/tool.c
index 1bb3ebe6..3b9cc255 100644
--- a/src/tool/tool.c
+++ b/src/tool/tool.c
@@ -144,11 +144,16 @@ ngt_RandomStr(char *String, const size_t len)
 	assert(String != NULL);
 
 	gettimeofday(&t, NULL);
+#ifndef HAVE_ARC4RANDOM
 	srand((unsigned)(t.tv_usec * t.tv_sec));
 
 	for (i = 0; i < len; ++i) {
 		String[i] = chars[rand() % (sizeof(chars) - 1)];
 	}
+#else
+	for (i = 0; i < len; ++i)
+		String[i] = chars[arc4random() % (sizeof(chars) - 1)];
+#endif
 	String[len] = '\0';
 
 	return String;