(bug) update algorithm to provide repeat value

Previously, the algorithm would generate new random value each invocation of the function.  Now, the function generates a primitive result based on the length of the strings.