+/**
+ * Fill a String with random chars
+ */
+GLOBAL char *
+ngt_RandomStr(char *String, const size_t len)
+{
+ static const char chars[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!\"#$&'()*+,-./:;<=>?@[\\]^_`";
+ struct timeval t;
+ size_t i;
+
+ 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;
+} /* ngt_RandomStr */
+
+