home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / perl / 5623 < prev    next >
Encoding:
Internet Message Format  |  1992-08-31  |  1.1 KB

  1. Path: sparky!uunet!gatech!bloom-beacon!eru.mt.luth.se!lunic!sunic!aun.uninett.no!nuug!nntp.uio.no!nntp.uio.no!aas
  2. From: aas@rosmer.nr.no (Gisle Aas)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: randomize.c
  5. Message-ID: <AAS.92Aug31133620@rosmer.nr.no>
  6. Date: 31 Aug 92 12:36:20 GMT
  7. References: <Btrt40.G6o@zardoz> <Bts28y.DJA@rahul.net>
  8. Sender: news@ulrik.uio.no (Mr News)
  9. Reply-To: Gisle.Aas@nr.no
  10. Organization: Norwegian Computing Centre, Oslo, Norway
  11. Lines: 14
  12. In-Reply-To: dhesi@rahul.net's message of Sun, 30 Aug 1992 03:41:21 GMT
  13. Nntp-Posting-Host: rosmer.nr.no
  14.  
  15. In article <Bts28y.DJA@rahul.net> dhesi@rahul.net (Rahul Dhesi) writes:
  16.  
  17. >   >The following short C program reads in lines from stdin, randomizes
  18. >   >their order, and then writes out the newly ordered lines to stdout.
  19. >
  20. >   I couldn't resist rewriting it in perl.
  21. >   
  22. >   [lots of lines deleted]
  23.  
  24. Why not:    perl -e '@l=<>;print splice(@l,rand($#l),1) while @l'
  25. --
  26. Gisle Aas               |  snail: Boks 114 Blindern, N-0314 Oslo, Norway
  27. Norsk Regnesentral      |  X.400: G=Gisle;S=Aas;O=nr;P=uninett;C=no
  28. voice: +47-2-453561     |  inet:  Gisle.Aas@nr.no
  29.