Open main menu
Home
Random
Nearby
Log in
Settings
About Kancolle Wiki
Disclaimers
Kancolle Wiki
Search
Changes
← Older edit
Module:RemiLib
(view source)
Revision as of 09:53, 24 June 2020
425 bytes added
,
3 years ago
m
no edit summary
Line 1:
Line 1:
+
-- [[Category:Net modules]]
+
local p = {}
local p = {}
Line 13:
Line 15:
end
end
return true
return true
+
end
+
+
function table.getKeys(self)
+
local keys = {}
+
for k,_ in pairs(self) do
+
table.insert(keys,k)
+
end
+
return keys
+
end
+
+
function table.getVals(self)
+
local vals = {}
+
for _,v in pairs(self) do
+
table.insert(vals,v)
+
end
+
return vals
end
end
Line 38:
Line 56:
-- Hashes a seed if given, if not just returns a hash based on current time.
-- Hashes a seed if given, if not just returns a hash based on current time.
function p.timeHash(seed)
function p.timeHash(seed)
+
-- lmfao this function wasn't a hash at all because it would never
+
-- return the same thing twice.
+
math.randomseed(p.hashString("Amatsukaze-chan is best"))
+
local randomizer = 0
local randomizer = 0
Line 69:
Line 91:
local time = os.time()
local time = os.time()
local rand = math.random()
local rand = math.random()
−
local rtnHash = (math.floor(time*
265314426625821
*rand)-randomizer*time)
% 2^32
+math.floor(math.random()*
1381242451)
*randomizer
+
local rtnHash = (math.floor(time*
5501
*rand)-
math.floor(
randomizer*time) + math.floor(math.random()*
5501
*randomizer
)) % 2^32
return rtnHash
return rtnHash
end
end
がか
cssedit, gkautomate
6,928
edits