Software /
code /
prosody
Comparison
util/uuid.lua @ 2957:805b067cd13e
util.uuid: Use a local instead of a global.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Thu, 01 Apr 2010 19:27:26 +0500 |
parent | 2923:b7049746bd29 |
child | 5776:bd0ff8ae98a8 |
child | 7010:001b3cff4ed8 |
comparison
equal
deleted
inserted
replaced
2956:15a145a67044 | 2957:805b067cd13e |
---|---|
30 local buffer = new_random(uniq_time()); | 30 local buffer = new_random(uniq_time()); |
31 local function _seed(x) | 31 local function _seed(x) |
32 buffer = new_random(buffer..x); | 32 buffer = new_random(buffer..x); |
33 end | 33 end |
34 local function get_nibbles(n) | 34 local function get_nibbles(n) |
35 if #buffer < n then seed(uniq_time()); end | 35 if #buffer < n then _seed(uniq_time()); end |
36 local r = buffer:sub(0, n); | 36 local r = buffer:sub(0, n); |
37 buffer = buffer:sub(n+1); | 37 buffer = buffer:sub(n+1); |
38 return r; | 38 return r; |
39 end | 39 end |
40 local function get_twobits() | 40 local function get_twobits() |