Microsoft Small Basic

Program Listing: FXJ326
alphabet = ("abcdefghijklmnopqrstuvwxyz")
'===================Main Program=================================================
input()
TextWindow.WriteLine("")
generate()
TextWindow.WriteLine("password (unshuffled) = " + password)
shuffle()
TextWindow.WriteLine("newPassword (shuffled) = " + newPassword)
'===================Subroutines====================================================
Sub generate
For l = 1 To letterFreq
letters[l] = Text.GetSubText(alphabet, Math.GetRandomNumber(Text.GetLength(alphabet)), 1)
joinLetters = Text.Append(allLetters, letters[l])
allLetters = joinLetters
EndFor
For n = 1 To numFreq
num[n] = Math.GetRandomNumber(10)-1 'returns 0 to 9 inclusive
joinNums = Text.Append(allNums, num[n])
allNums = joinNums
EndFor
password = allLetters + allNums
EndSub

Sub shuffle
length = Text.GetLength(password)
For q = 1 To length
up:
n = Math.GetRandomNumber(length)
If Array.ContainsValue(val, n) = "true" Then
Goto up
Else
val[q] = n
EndIf
shufflePassword[q] = Text.GetSubText(password, val[q], 1)
appendWord = Text.Append(newPassword, shufflePassword[q])
newPassword = appendWord
EndFor
EndSub

Sub input
TextWindow.Write("How long is your password? ")
length = TextWindow.Read()
TextWindow.Write("How many numbers will it contain? ")
numFreq = TextWindow.Read()
letterFreq = length - numFreq
EndSub