Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #33931

Re: Random permutations [was Re: Libraries for sysadmins?]

Path csiph.com!news.mixmin.net!news.albasani.net!.POSTED!not-for-mail
From Sebastian <news@seyweiler.dyndns.org>
Newsgroups comp.lang.java.programmer
Subject Re: Random permutations [was Re: Libraries for sysadmins?]
Date Sat, 05 Mar 2016 16:41:42 +0100
Organization albasani.net
Lines 23
Message-ID <nbeunm$drn$1@news.albasani.net> (permalink)
References <2cec6af2-9636-4a2a-8849-b01286c0814c@googlegroups.com> <sysadmins-20160304161143@ram.dialup.fu-berlin.de> <djttl0Fct5hU1@mid.individual.net> <dju62bFf4ouU1@mid.individual.net> <concise-20160304210431@ram.dialup.fu-berlin.de> <nbd7c3$3jp$1@news.albasani.net> <djvt76Fs5qfU2@mid.individual.net>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.albasani.net DKNWp3I7mRIFDU5V3URGz1Njeuw6wI0I5tKGgRSkHdE48jMlk2/E0VnbmuhJXl9dcKeVVJO/A/DkoGqOQpfQEA==
NNTP-Posting-Date Sat, 5 Mar 2016 15:41:42 +0000 (UTC)
Injection-Info news.albasani.net; logging-data="eempd8lc7Ia78lbk3fUiSoTceXaqyOls0+/9a0if06ItVeHGkBXux6jsxIEXFMZdd0yart6S/1ltrO7gLiFb940XKRKEdMmHsSny5DmOI9RrCwUVmuqG+NRUr8TG8MlP"; mail-complaints-to="abuse@albasani.net"
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
In-Reply-To <djvt76Fs5qfU2@mid.individual.net>
Cancel-Lock sha1:y04OXhKArbP8aXWFH4emE1EQ8c8=
Xref csiph.com comp.lang.java.programmer:33931

Show key headers only | View raw


Am 05.03.2016 12:11, schrieb Robert Klemme:
> On 05.03.2016 00:56, Sebastian wrote:
>
>> This is good if you need about as many elements in the result as are in
>> the range. But if the range is large and you need only a few elements,
>> it may be better to generate numbers (without duplicates), like this:
>>
>> new Random().ints(1, 50).distinct().limit(6)
>
> Are you sure this has the same probability characteristics as picking
> six random items from a list of 49?
>
> Cheers
>
>      robert

I think yes, because Random#ints() is evenly distributed. And as I said, 
this is useful when the range is much larger than the sample size. The 
farther they diverge, the smaller the probability of a collision would 
become in the first place.

-- Sebastian

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Libraries for sysadmins? Elena <egarrulo@gmail.com> - 2016-03-04 03:33 -0800
  Re: Libraries for sysadmins? Martin Gregorie <martin@address-in-sig.invalid> - 2016-03-04 11:44 +0000
    Re: Libraries for sysadmins? egarrulo <egarrulo@gmail.com> - 2016-03-04 12:56 +0100
  Re: Libraries for sysadmins? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-03-04 07:43 -0500
  Re: Libraries for sysadmins? Robert Klemme <shortcutter@googlemail.com> - 2016-03-04 18:06 +0100
    Re: Libraries for sysadmins? egarrulo <egarrulo@gmail.com> - 2016-03-04 20:30 +0100
      Random permutations [was Re: Libraries for sysadmins?] Sebastian <news@seyweiler.dyndns.org> - 2016-03-05 00:56 +0100
        Re: Random permutations [was Re: Libraries for sysadmins?] Robert Klemme <shortcutter@googlemail.com> - 2016-03-05 12:11 +0100
          Re: Random permutations [was Re: Libraries for sysadmins?] Sebastian <news@seyweiler.dyndns.org> - 2016-03-05 16:41 +0100
            Re: Random permutations [was Re: Libraries for sysadmins?] Brixomatic <brixomatic@yahoo.com> - 2016-03-05 19:20 +0100
              Re: Random permutations [was Re: Libraries for sysadmins?] Andreas Leitgeb <avl@logic.at> - 2016-03-05 18:46 +0000
                Re: Random permutations [was Re: Libraries for sysadmins?] Brixomatic <brixomatic@yahoo.com> - 2016-03-15 19:22 +0100
                Re: Random permutations [was Re: Libraries for sysadmins?] Andreas Leitgeb <avl@logic.at> - 2016-03-15 22:30 +0000
            Re: Random permutations [was Re: Libraries for sysadmins?] Andreas Leitgeb <avl@logic.at> - 2016-03-05 18:30 +0000
              Re: Random permutations [was Re: Libraries for sysadmins?] Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-03-05 13:46 -0500
                Re: Random permutations [was Re: Libraries for sysadmins?] Andreas Leitgeb <avl@logic.at> - 2016-03-05 19:40 +0000
      Re: Libraries for sysadmins? Robert Klemme <shortcutter@googlemail.com> - 2016-03-05 12:10 +0100
    Re: Libraries for sysadmins? Arne Vajhøj <arne@vajhoej.dk> - 2016-03-04 21:42 -0500
  Re: Libraries for sysadmins? Arne Vajhøj <arne@vajhoej.dk> - 2016-03-04 21:48 -0500

csiph-web