/ Published in: Perl
Expand |
Embed | Plain Text
sub pick { ################# #construct the triangular number sequence of the sums of the fitness _ranks_ of the (ascension sorted) population containing POP elements #pick a random point less than the total of the sums of said triangular sequence #determine which element's interval this falls into #select and return that element ################# my ($pop) = @_; #sum of the triangular sequence 1..POP state $tot = (POP+POP**2)/2; #found by solving x = (n^2-n)/2 + n for n }
You need to login to post a comment.
