in reply to Trial and error problems in Perl
Like most programming, start with how you'd do it by hand. You might realise how many assumptions you've made, or maybe not, but your code can be written to follow the same method to get similar answers.
For example, come up with a nice random number first (rand) ... but in what range? To what precision? Are negative values allowed? These will all impact the way to come up with the next random number (whose range will be determine by the original range, modified by the previous number). And, finally, the last number just is 10.33 minus the total of the other two numbers.
My useful resource is usually "how would I do this by hand" - and I go from there. Good luck!
|
|---|