I could not understand how to get a trully randomic integer.
Suppose I need
50 randomic integers each time I call a function. Serching in
Assuming you want to print 50 uniform random integers between 0 and
100:
for i=1,50 do
print(math.floor(math.random()*100))
end
---
On Sat, Jan 16, 2010 at 5:12 PM, Luciano de Souza
<luchyanus@predialnet.com.br> wrote:
Hi all,
I could not understand how to get a trully randomic integer.
Suppose I need
50 randomic integers each time I call a function. Serching in
documentation,
I found two functions in Math module: math.random and
math.randomseed.
The first one is not what I want. Calling it, I got always the
same 50
numbers. In Pascal, before using random functions, it's necessary
to call
"randomize" which starts the randomic number generator. I don't
know if it's
also necessary in Lua.
But I try to use math.randomseed. The first tesst is:
print(math.randomseed(100))
print(math.randomseed(0, 100))
Despite no errors, I dindn't get anything. So I ask: how to obtain 50
different integers each time I call the randoms functions?
Luciano de Souza