Shuffle a string in a repeatable way The following function is designed to accept a string of characters and an integer.  The function returns a string that's a reordered version of the original string.  The reordering process is controlled by the second variable.  If the function is called again with the same string and a different number, a different string will be returned.
However, if the string and the integer do not change, repeat calls to this function will always return the same string.  as the integer changes, the returned strings should not appear to be similar.  I have tested this function on the following string, with integer values between 0 and 40000 without finding a duplicate returned string.  

"1234567890abcdefghijklmnopqrstuvwxyz"


Are there obvious improvements that can be made? 
I am also curious about this function's limitations.
So far, it seems to perform rather well.

function shuffleString($inputString, $seed = 2000){

    $strLength = strlen($inputString);
    $newString = "";
    $factor = 3 + (int)($seed / $strLength);

    while($strLength &gt; 0){

        $seed += $factor;

        if($seed &gt;= $strLength){
            $seed = $seed % $strLength; 
        }

        $newString .= $inputString[$seed];

        $copyStr = "";

        $strLength --;

        if($seed != 0){
            $copyStr = substr($inputString,0,$seed);
        }

        if($seed != $strLength){
            $copyStr .= substr($inputString,$seed+1);
        }

        $inputString = $copyStr;

    }

    return $newString.$inputString;

}


Example:

echo shuffleString("1234567890abcdefghijklmnopqrstuvwxyz", 1234), '&lt;br /&gt;';
echo shuffleString("1234567890abcdefghijklmnopqrstuvwxyz", 1234), '&lt;br /&gt;';
echo shuffleString("1234567890abcdefghijklmnopqrstuvwxyz", 1234), '&lt;br /&gt;';
echo shuffleString("1234567890abcdefghijklmnopqrstuvwxyz", 1234), '&lt;br /&gt;';
echo shuffleString("1234567890abcdefghijklmnopqrstuvwxyz", 4567), '&lt;br /&gt;';
echo shuffleString("1234567890abcdefghijklmnopqrstuvwxyz", 4567), '&lt;br /&gt;';
echo shuffleString("1234567890abcdefghijklmnopqrstuvwxyz", 4567), '&lt;br /&gt;';
echo shuffleString("1234567890abcdefghijklmnopqrstuvwxyz", 4567), '&lt;br /&gt;';


returns

beint19kw0q7sf4xrpv3dyjgl2ozh58m6cau
beint19kw0q7sf4xrpv3dyjgl2ozh58m6cau
beint19kw0q7sf4xrpv3dyjgl2ozh58m6cau
beint19kw0q7sf4xrpv3dyjgl2ozh58m6cau
g6yvx5fujbaitkdm2s3oqcnl074hr8wp19ze
g6yvx5fujbaitkdm2s3oqcnl074hr8wp19ze
g6yvx5fujbaitkdm2s3oqcnl074hr8wp19ze
g6yvx5fujbaitkdm2s3oqcnl074hr8wp19ze


also:

for($i=0; $i&lt;5; $i++){
    $dataStr = "1234567890abcdefghijklmnopqrstuvwxyz";
    for($j=0; $j&lt;2000; $j++){
        $dataStr = shuffleString($dataStr, ord($dataStr[0]));
    }
    echo $dataStr . '&lt;br /&gt;';
}


returns:

gdwy63zmnjxharpovk50qulf2cei8t174bs9
gdwy63zmnjxharpovk50qulf2cei8t174bs9
gdwy63zmnjxharpovk50qulf2cei8t174bs9
gdwy63zmnjxharpovk50qulf2cei8t174bs9
gdwy63zmnjxharpovk50qulf2cei8t174bs9
Why does it need to be this complicated? PHP has builtins for changing the seed of the random number generator, and for shuffling strings.

function shuffleString($input, $seed = 2000) {
    srand($seed); // set the random generator seed
    $shuffled = str_shuffle($input);
    srand(); // to ensure that the seed is reset
    return $shuffled;
}


This might be less efficient (I haven't benchmarked them) but it's simpler and more readable. Sometimes it's fun to reinvent the wheel, but there are usually shortcuts that can be taken.