MathGroup Archive 1994

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

Search the Archive

Re: Unique List

  • To: mathgroup at
  • Subject: [mg365] Re: [mg358] Unique List
  • From: Richard Mercer <richard at>
  • Date: Tue, 27 Dec 1994 14:00:53 -0500

>  OK, time for a little fun.  I can generate a list of
>  random integers as    Table[Random[Integer,{1,42}],{6}]
>  and I get a list 6 elements long containing the integers
>  from 1 to 42.  But how do I make sure no elements are
>  repeated.

>  I'm trying to simulate a lottery pick of 6 numbers between
>  1 and 42 but no repeats are allowed.  Any clever tricks
>  to get a list with no members repeated?

>  Thanx, Good Luck and Happy New Year to all.

One good way, which gives equal probability to all results (assuming  
RandomPermutation does what I think):

{10, 18, 22, 24, 33, 41}

Richard Mercer

  • Prev by Date: Re: Unique List
  • Next by Date: Re: Messages[] Problem/bug?
  • Previous by thread: Re: Unique List
  • Next by thread: Messages[] Problem/bug?