Generate a random level? I'm not sure what your talking about; 'cause I never actually played 2k1. Just sat on it and talked and worked on Frolic. But, I'm pretty sure the map is like an array, like:
Level_Letter-#.graal
So make an array of letters, then tokenize it, and generate a random #, and letter.
NPC Code:
setstring this.letter = #t(int(rand(0,arraylen(lettersarray))));
this.randnum = int(rand(0,maxnum)))
Then use those in the setlevel part.