summaryrefslogtreecommitdiff
path: root/src/librandom/autosurf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/librandom/autosurf.c')
-rw-r--r--src/librandom/autosurf.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/librandom/autosurf.c b/src/librandom/autosurf.c
new file mode 100644
index 0000000..8775bef
--- /dev/null
+++ b/src/librandom/autosurf.c
@@ -0,0 +1,18 @@
+/* ISC license. */
+
+#include <skalibs/random.h>
+#include <skalibs/surf.h>
+
+void autosurf (char *s, size_t n)
+{
+ static SURFSchedule ctx = SURFSCHEDULE_ZERO ;
+ static int need4seed = 1 ;
+ if (need4seed)
+ {
+ char tmp[160] ;
+ random_makeseed(tmp) ;
+ surf_init(&ctx, tmp) ;
+ need4seed = 0 ;
+ }
+ return surf(&ctx, s, n) ;
+}