Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Random choice

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99843] Re: Random choice
  • From: Valeri Astanoff <astanoff at gmail.com>
  • Date: Sat, 16 May 2009 05:19:14 -0400 (EDT)
  • References: <guj8ef$hv6$1@smc.vnet.net> <gujfte$of6$1@smc.vnet.net>

On 15 mai, 12:24, Ray Koopman <koop... at sfu.ca> wrote:
> On May 15, 1:17 am, Valeri Astanoff <astan... at gmail.com> wrote:
>
>
>
>
>
> > Good day,
>
> > Given this example :
>
> > In[1]:= RandomChoice[Range[500], 100] // Union // Length
>
> > Out[1]= 91
>
> > what is the best way to get *exactly* 100 different
> > random numbers ranging from 1 to 500 ?
>
> > Any piece of advice would be appreciated.
>
> > --
>
> > Valeri Astanoff
>
> RandomSample[Range[500], 100] // Union // Length
>
> Given the well-established meaning of m_Choose_n for sampling without
> replacement, whoever decided on the new terminology got RandomChoice
> and RandomSample backwards.- Masquer le texte des messages pr=E9c=E9dents=
 -
>
> - Afficher le texte des messages pr=E9c=E9dents -

Thanks, Ray, (and Daniel and...) to let me (and some other posters !)
know the existence of "RandomSample" : it does just what I was looking
for.

v.a.


  • Prev by Date: Preventing swapping (high memory use)
  • Next by Date: Map conditional sums by date
  • Previous by thread: Re: Random choice
  • Next by thread: Re: Is there a BNF for Mathematica?