Roy Johnson's is correct in response to the question your asked and Transient's reply looks "right" but it's his last line and shltn's reply that address a fundamental fallacy in your $var_names and the language of your description of your problem (note, ++, that your title is "bang on" for the first part of your question.)
Simply put, your script provides NOelement of randomness other than the inappropriate naming of the variables; "inappropriate" because they do NOT describe the variables with anything resembling what they actually contain).
Every value is either defined or deterministic. Look at your code:
my $randomx=37; # the seed for x
005: my $randomy=1531; # the seed for y
The only process that changes those assignments occurs below (inside the while loop) at (abbreviated):
$n_randomx=(($randomx*106+1283) % 6075) / 6075;
...
$randomx=$n_randomx;
which is to say, the next iteration is different from the last only in that it uses the latest (ie, "predictable" or "deterministic" $n_randomx, assigned to $randomx, to set the starting point for the next iteration.
There is simply no way to achieve "randomness" nor even pseudo-randomness, by multipling, dividing, dividing-modulus, adding or subtracting a fixed and restricted set of numbers (which is another way to say "defined or deterministic numbers".
And while your output may look, to you, "random" after you've removed the divide-by-6075, it isn't. Again, the output remains the same for each run, and worse, with a fairly modest effort, a mathemetician, cryptographer or the like could easily use a comparatively small segment of your output to ascertain your input.
That said, the output may be sufficiently varied to satisfy some purpose you have, but you had best NOT use it to "secure" anything ... and you'll do yourself a favor, long term, to avoid naming variables using words that suggest their contents are something they're not. At best you'll confuse some future user or maintainer, and at worst, confuse yourself.
|