GetSystemTimer
This function was added in DSL 4
Description
Returns the value of GetTickCount
, primarily intended for use with math.randomseed
to improve the random number generator.
Retrieves the number of milliseconds that have elapsed since the system was started, up to 49.7 days.
function GetSystemTimer() --[[ ... ]] end
Parameters
None.
Return Values
The return value is the number of milliseconds that have elapsed since the system was started.
tickCount
:number
- The value ofGetTickCount
, which is the number of milliseconds since the system started.
Example
function main()
-- Seed the random number generator with the current system timer
math.randomseed(GetSystemTimer())
-- Generate a random number between 1 and 100
local randomNumber = math.random(1, 100)
print('Random Number: ' .. randomNumber)
end