Trouble generating string-based seeds
Posted: Tue Oct 31, 2017 9:40 pm
Hello everyone,
I've been experimenting with random generation, and seed-based stuff. I'm not really sure of the best way to do this, previously I just called love.math.setRandomSeed(seed) in love.load.
What I want to do is let the user input a string that can be used for a string. Currently, I have this function:
The problem is, almost any seed i put in is too big, and just sets the seed to 0!
I'm really not sure how to fix this, I'd be really grateful for any help.
Thanks in advance,
Noah
I've been experimenting with random generation, and seed-based stuff. I'm not really sure of the best way to do this, previously I just called love.math.setRandomSeed(seed) in love.load.
What I want to do is let the user input a string that can be used for a string. Currently, I have this function:
Code: Select all
function generateSeed(seed)
seedStringOfNumbers = ""
for i = 1, string.len(seed) do
seedStringOfNumbers = seedStringOfNumbers .. tostring(string.byte(string.sub(seed, i, i)))
end
print(seedStringOfNumbers)
return(seedStringOfNumbers)
--love.math.setRandomSeed(tonumber(seedStringOfNumbers))
end
I'm really not sure how to fix this, I'd be really grateful for any help.
Thanks in advance,
Noah