aboutsummaryrefslogtreecommitdiffstats
path: root/util/random.lua
diff options
context:
space:
mode:
Diffstat (limited to 'util/random.lua')
-rw-r--r--util/random.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/util/random.lua b/util/random.lua
new file mode 100644
index 00000000..05f36aba
--- /dev/null
+++ b/util/random.lua
@@ -0,0 +1,21 @@
+-- Prosody IM
+-- Copyright (C) 2008-2014 Matthew Wild
+-- Copyright (C) 2008-2014 Waqas Hussain
+--
+-- This project is MIT/X11 licensed. Please see the
+-- COPYING file in the source package for more information.
+--
+
+local urandom = assert(io.open("/dev/urandom", "r"));
+
+local function seed()
+end
+
+local function bytes(n)
+ return urandom:read(n);
+end
+
+return {
+ seed = seed;
+ bytes = bytes;
+};