« Module:RandomString » : différence entre les versions

De Adadov.net wiki
(Page créée avec « local p = {} function p.randomString(length) local res = "" for i = 1, length do res = res .. string.char(math.random(97, 122)) end return res end return p »)
 
Aucun résumé des modifications
 
Ligne 2 : Ligne 2 :


function p.randomString(length)
function p.randomString(length)
math.randomseed(os.time())
math.randomseed(os.time())
math.randomseed(os.time())
local res = ""
local res = ""
for i = 1, length do
for i = 1, length do

Dernière version du 14 janvier 2023 à 22:43

Documentation icon Documentation Module[créer]
local p = {}

function p.randomString(length)
	math.randomseed(os.time())
	math.randomseed(os.time())
	math.randomseed(os.time())
	local res = ""
	for i = 1, length do
		res = res .. string.char(math.random(97, 122))
	end
	return res
end

return p