Article View: pl.comp.lang.ruby
Article #1218Re: rozrzucić
From: Przemysław Kowalczyk
Date: Wed, 18 Feb 2009 18:10
Date: Wed, 18 Feb 2009 18:10
20 lines
1347 bytes
1347 bytes
On Wed, 18 Feb 2009 12:22:07 +0100, Radosław Bułat <radarrek@poczta.fm>
wrote:
> Od Bronisław Tatul pisze:
>> Mam pytanie. Jak rozrzucic losowo elementy w tablicy. Chodzi mi o coś
>> odwrotnego do sortowania.
>
> arr = (1..10).to_a
> arr = arr.sort_by { rand }
nigdy tak nie rob, patrz:
http://szeryf.wordpress.com/2007/06/19/a-simple-shuffle-that-proved-not-so-simple-after-all/
szegolnie ostatni podrozdzial.
pzdr
szeryf
--
Przemysław ,,Szeryf'' Kowalczyk :: http://szeryf.wordpress.com/
Technical Details
Message-ID:
<op.upj7gcr3uw9fft@negative-361apc>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.task.gda.pl!not-for-mailReferences:
<gngc3r$t4t$1@atlantis.news.neostrada.pl> <gngr0v$eu$1@inews.gazeta.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.task.gda.pl!not-for-mail From: Przemysław Kowalczyk <someone@microsoft.com> Newsgroups: pl.comp.lang.ruby Subject: Re: rozrzucić Date: Wed, 18 Feb 2009 19:10:50 +0100 Organization: CI TASK http://www.task.gda.pl/ Lines: 20 Message-ID: <op.upj7gcr3uw9fft@negative-361apc> References: <gngc3r$t4t$1@atlantis.news.neostrada.pl> <gngr0v$eu$1@inews.gazeta.pl> NNTP-Posting-Host: host-81-190-218-64.wroclaw.mm.pl Mime-Version: 1.0 X-Trace: news.task.gda.pl 1234980703 15335 81.190.218.64 (18 Feb 2009 18:11:43 GMT) X-Complaints-To: abuse@news.task.gda.pl NNTP-Posting-Date: Wed, 18 Feb 2009 18:11:43 +0000 (UTC) User-Agent: Opera Mail/9.10 (Win32) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit