in reply to randomize a text file

How do you want it randomised?

Given:

a b c d e f g h i j k l m n o p q r s t u v w x y

Do you want (randomise rows; columns stay the same):

k l m n o u v w x y f g h i j p q r s t a b c d e

Or (randomise the columns; rosw stay the same):

c b d e a h g i j f m l n o k r q s t p w v x y u

Or (randomise both):

h g i j f w v x y u c b d e a r q s t p m l n o k

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: randomize a text file
by perlnoobster (Sexton) on Jul 17, 2013 at 13:55 UTC
    Hi BrowserUk, I want to randomize the rows, i.e. the columns stay the same, can you help me? thank you
      , can you help me?

      Depends. Post code that reads the file into an array, then maybe.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      If you want to randomize rows only, read your file into an array of rows, apply shuffle from List::Util and print shuffled array into new file. That's all, probably just a one-liner, don't even need to chomp.