in reply to How can one randomize a DNA string without changing the composition?

You might be interested in a small pure Perl solution, which I stole from a QOTW entry (which I can't locate).
# 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

  • Comment on Re: How can one randomize a DNA string without changing the composition?
  • Download Code

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
      Thanks.

      There is a similar version, I recall, which just returns the next permutation, or can be turned into an iterator. For some reason I think I saw them on something MJD wrote, but it may originate from someone else through him.

      -QM
      --
      Quantum Mechanics: The dreams stuff is made of