G
G
Gold Smith2021-08-20 20:16:43
Lua
Gold Smith, 2021-08-20 20:16:43

Generating a random ten digit number with pauses in a loop?

How can I generate a random number of 10 digits long with pauses of 5000 ms, in a loop to infinity?
For example
Console output: 3710749921
pause 5 seconds
Console output: 5350169427
pause 5 seconds
...

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Dmitry, 2021-08-20
@LGoldSmith

Random number random and randomseed
There is no delay function in lua out of the box, here is the solution:

local clock = os.clock
function sleep(n)  -- Секунды
  local t0 = clock()
  while clock() - t0 <= n do end
end

-- использование
sleep(5)

UPD: You can do this:
local clock = os.clock
function sleep(n)  -- Секунды
  local t0 = clock()
  while clock() - t0 <= n do end
end

sleep(5)
print(math.random(os.time()))
sleep(5)
print(math.random(os.time()))
sleep(5)
print(math.random(os.time()))
-- ...

T
throughtheether, 2014-06-10
@Qwofer

This is a wifi access point (router). One twisted pair is included, but both data (Ethernet frames) and power (using PoE ) are transmitted through it. Accordingly, this device 'distributes wi-fi', that is, in some way (routing, bridging) transmits data between devices connected via twisted pair and wireless clients.

K
Konstantin, 2014-06-10
@fallen8rwtf

is it possible to take a photo of the back cover? and if you "suspect" - measure the level of wifi wavemon, for example)))

A
Andrey Burov, 2014-06-10
@BuriK666

wi-fi point with POE
Similar to DWL-3200AP

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question