lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, 15 May 2008 14:03:37 -0300
Jorge Visca <xxopxe@gmail.com> wrote:

> them. Or somehow get a number from /dev/urandom... Sadly, "date +%N"
> doesn't work on my platform. Any ideas?
local function Randomize ()
  local fl = io.open("/dev/urandom");
  local res = 0;
  for f = 1, 4 do res = res*256+(fl:read(1)):byte(1, 1); end;
  fl:close();
  math.randomseed(res);
end;
?