Fixed the issue #1

Sometimes the index of a random character is negative, producing
the weird binary characters