//Contributed by: Haywire
/*
Basic use of BYOND's copytext() function in combination with a loop and a variable to return a set of alphanumeric characters in random order. This was inspired when I started to build mine for the activate-code system for my website, although my one is built in PHP and goes beyond alphanumeric characters.
*/
proc
GenerateCode(var/length)
var lookFrom = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"// the string of alphanumeric characters
for(var/i=1;i<=length;i++)// looping through each char until the length size has been met
var/random = rand(1,length(lookFrom))// gets a random number from 1 and the length of the string lookFrom
. += copytext(lookFrom,random,random+1)// adding the randomly selected char to the return variable
--Haywire