Skip to content

Instantly share code, notes, and snippets.

@LunaSquee
Created February 24, 2017 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LunaSquee/ca33bc02c4b5baefe8fc815fc28f40a3 to your computer and use it in GitHub Desktop.
Save LunaSquee/ca33bc02c4b5baefe8fc815fc28f40a3 to your computer and use it in GitHub Desktop.
Godot utilities
# UUID Generation
func generate_uuid():
var repls = "xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx"
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
for c in range(0, repls.length()-1):
if repls[c] == "x":
randomize()
var rander = rand_range(1, chars.length()) - 1
repls[c] = chars[floor(rander)]
return repls
# Random hash with length
func rand_hash(len):
var string = ""
var characters = "abcdefghijklmnopqrstuvwxyz1234567890"
for i in range(0, len):
randomize()
string += characters[rand_range(1, characters.length()) - 1]
return string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment