Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Loaded die

by ELISHEVA (Prior)
on Mar 28, 2011 at 13:09 UTC ( #895901=note: print w/ replies, xml ) Need Help??


in reply to Loaded die

Well, for starters in might have something to do with the way you are creating your hash %hash. Each time you cycle through the outer loop @start_array grows in size (by a factor of 5) so each throw of the die results in every more iterations in the inner two loops. Here is what the count looks like:

throw of die: 1: iterations in inner two loops: 25 total iterations: 25 throw of die: 2: iterations in inner two loops: 125 total iterations: 150 throw of die: 3: iterations in inner two loops: 625 total iterations: 775 throw of die: 4: iterations in inner two loops: 3125 total iterations: 3900 throw of die: 5: iterations in inner two loops: 15625 total iterations: 19525 throw of die: 6: iterations in inner two loops: 78125 total iterations: 97650 throw of die: 7: iterations in inner two loops: 390625 total iterations: 488275 throw of die: 8: iterations in inner two loops: 1953125 total iterations: 2441400 ...

Did you mean for @start_array to be growing in size this way? By dice throw 10, @start_array will have 5 to the 10th power number of elements and the 10th throw will require 5*11 iterations to complete.


Comment on Re: Loaded die
Select or Download Code
Replies are listed 'Best First'.
Re^2: Loaded die
by Microcebus (Beadle) on Mar 28, 2011 at 13:17 UTC
    Yes, the growing size of @start_array is the problem. The array contains the same compositions many times (one time for each possible chronology) which I count when I create the hash. I think there must be a smarter way...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://895901]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (15)
As of 2015-07-28 13:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (254 votes), past polls