MathGroup Archive 2013

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

Search the Archive

Re: Needing a Random List of Non-repeating Values whose Range and Length

  • To: mathgroup at smc.vnet.net
  • Subject: [mg129511] Re: Needing a Random List of Non-repeating Values whose Range and Length
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sat, 19 Jan 2013 01:15:09 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net

On 1/18/13 at 12:54 AM, brtubb090530 at cox.net wrote:

>Consider the following:

>ril[range_Integer]:= RandomInteger[{1,range},range]

>This function is almost what I want; but I need one which doesn't
>include any repeated values. This is intended for use, for example,
>for a card deck, or dice, etc.

Perhaps you should look at RandomSample. For example, if you
associate the integers from 1 to 52 with the 52 possible cards
(excluding jokers) in a deck

RandomSample[Range@52,5]

would return 5 values representing a random 5 card draw from the deck




  • Prev by Date: Re: Needing a Random List of Non-repeating Values whose Range and Length
  • Next by Date: Re: Prime numbers and primality tests
  • Previous by thread: Re: Needing a Random List of Non-repeating Values whose Range and Length
  • Next by thread: Re: Needing a Random List of Non-repeating Values whose Range and Length