Fixed bug for random number range

Range was [0, MAXN], should have been [0, MAXN). Does not affect
previously generated pass phrases, because out-of-range random numbers
raised an exception.
Added references, consideration of spaces