| Subject: | Re: rand() |
|---|---|
| From: | jwkrahn@xxxxxxx (John W. Krahn) |
| Date: | Mon, 28 Jul 2008 11:37:45 -0700 |
| Newsgroups: | perl.beginners |
Bobby wrote: That helps but how would i just get back an X number of random numbersbecause @nums could be in the hundreds of unique numbers. For instance, i just want to randomly pickout 4 numbers from a long list of unique numbers in @nums, how would i do that? use List::Util qw' shuffle '; my $X = 4; my @random = ( shuffle @nums )[ 0 .. $X - 1 ]; John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: rand(), Mr. Shawn H. Corey |
|---|---|
| Next by Date: | Re: rand(), Chris Charley |
| Previous by Thread: | Re: rand(), Bobby |
| Next by Thread: | Re: rand(), Chris Charley |
| Indexes: | [Date] [Thread] [Top] [All Lists] |