Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

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

Advanced Search

Back to Topic List Back to Topic List  
Bill Rowe

Posts: 1,647
Registered: 3/14/08
Re: Needing a Random List of Non-repeating Values whose Range and Length
Posted: Jan 19, 2013 1:13 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 1/18/13 at 12:54 AM, brtubb090530@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





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.