The test used rand(32, 127) to select the character, however chr(127) results in "data" instead of the expected result, so this test would fail in something like 1% of the runs. Replace rand() with fixed character "a".