in reply to How can one randomize a DNA string without changing the composition?
# Find and return the $n'th permutation # of the remaining arguments in some canonical order # (modified from QOTW solution) sub permutation_n { my $n = shift; my $result = ''; while (@_) { ($n, my $r) = (int($n/@_), $n % @_); $result .= splice @_, $r, 1; } return $result; }
-QM
--
Quantum Mechanics: The dreams stuff is made of
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How can one randomize a DNA string without changing the composition?
by Anonymous Monk on Jan 16, 2015 at 11:36 UTC | |
by QM (Parson) on Jan 16, 2015 at 11:44 UTC |