There a way to make sure two elements aren't randomly chosen twice?

I want to make an array of 52 cards - then draw 21, but I want to make sure not to have any duplicates....
Is there some easy way with ArrayLists or Linked lists to accomplish this?
I am going to make a second array of random cards and thought of somehow making a variable or logic that reports that the card is taken, but I cant help but think there is a way to shrink the array as I take the card out or something like that.
Help?
Message was edited by:
tvance929

import java.util.*;
public class ShuffleExample {
     public static void main(String[] args) {
          List < Integer > list = new ArrayList < Integer > ();
          //start of with [0,51], for the sake of example
          for(int i=0; i < 52; ++i)
               list.add(i);
          Collections.shuffle(list);
          System.out.println(list.subList(0, 21));
}

Similar Messages

  • Is there a way to make sure my MBP doesn't use a particular resolution or ?

    This may be a stupid question. I am hooking my MBP to my lcd tv. When I first connected the television, my tv displayed the message "mode not supported". Having played a little at this I simply went to my display preferences and looked at what resolution was running to my tv. (I have my display preferences in the toolbar) It was running 1920x1080 at 60Hz and right above that there was another 1920x1080 at 60Hz so I clicked on that and my external display lit right up. (Turns out the second resolution's refresh rate is actually 59.9Hz) So no problem right? Well I use this set up as sort of a media center so I like to run my MBP with its lid closed. When I close the lid, and rewake the MBP, my television gives me the message "mode not supported". So there is a signal but the tv can't display it. This leads me to believe that when I close the lid on my MBP it decides to run at the 60Hz as opposed to the functional 59.9Hz. The problem is I can't see the display to change the resolution or refresh rate. Is there a way to make sure my MBP doesn't use a particular resolution or refresh rate? I have tried changing it before I close the lid. I have tried it in mirrored display mode. Nothing works so far. Please Help!

    Not really. In the Displays preferences you can only check the option to show supported resolutions, but that only will be present with another display connected (I believe.) On laptops it isn't an option, obviously, but it may be present once you connect an external display.
    You might try using the shareware utility SwitchResX - VersionTracker or MacUpdate.

  • HT4859 I used a purchased program iannotate to download, highlight and store many documents. My ipad is brocken and I m ahtinking of getting it replaced by Apple for a payment of 240 or so. Is there a way to make sure that I do not lose pdf documents in i

    I used a purchased program iannotate to download, highlight and store many documents. My ipad is brocken and I m ahtinking of getting it replaced by Apple for a payment of 240 or so. Is there a way to make sure that I do not lose pdf documents in iA?

    I am sorry that you don't find the answer to be correct. In THIS forum, telling you that you are in the wrong forum, and suggesting where to post for correct answers, or indeed any support, IS the answer.
    I'm also sorry that you purchased a phone that you are having trouble with. If the vendor cannot help you (HTC), and the eBay seller cannot help you, then you really do need to either follow up with the forums Ken suggests, or the HTC forum, or with eBay.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog:http://unlockpowershell.wordpress.com
    My Book:Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C40686F746D61696C2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • Are there any ways to make sure FCPX saves the project before quitting?

    The other day when I was working on a project, Final Cut Pro did not save any changes I made for the last 3 hours. I lost all of my work. I understand that FCP is supposed to autosave  projects, but it didn't. Are there any ways to make sure that it saves before quitting? I am currently running the trial version 10.0.8, and I plan to upgrade to the full version, soon, provided there aren't too many bugs.

    It turns out it was a corrupted project. All other projects autosave before quitting, but that one always displays the same last modified time. I solved it by creating a brand new project.

  • Is it secure to have the pulic open a resource guide in Adobe Reader?  Or is there a way to make sure anyone using the link to the guide is secure?

    Is it secure to have the public open a resource guide in an Adobe Reader PDF?  Or is there a way to make sure anyone using the link to the guide is protected?
    Not sure how to find an answer to this.
    Thanks, GM

    I am trying to post a 123 page resource guide online for the public to access through the website of a non profit.  The guide has a lot of web links for to use for more information.  But there have been clickability issues when using some browsers to download the PDF and so I would prefer to suggest that they try to download the resource into Adobe Reader before using.  I want to make sure that this would securely safe for readers and users.
    Sorry I was not clear in my original question and thank you for your kind attention.
    Thank you again,
    GM

  • Is there a way to make sure firefox does not erase the address bar list

    First of all I have no idea where I am supposed to ask this so forgive me if I am in the wrong place. I have noticed when firefox erases it's history all of the web addresses are erased from the location bar. This is a huge inconvenience. Is there a way to 1: customize the bar quickly with all my favorite websites and 2: prevent firefox from erasing the address list in the location bar?

    # See [[How to customize the toolbar]] and [[Bookmarks Toolbar]]
    # Don't clear browsing history. See more info in [[Clear Recent History]].

  • Trying to backup an iPhone 3gs so we can update the iOS. Old computer does not appear to back up contacts and notes (there are many). Is there a way to make sure they are backed up?

    Also, everytime we sync, emails delete from the iPhone. We don't want them to. Is there a setting to prevent this from happening?

    Contacts are not part of the backup. Those should be synced with a compatible address book on your computer. Notes can sync with a mail account.
    No idea what you mean about emails deleting from the phone when you sync. E-mail messages are not synced with anything but the mail server. Only account information is synced.

  • Is there are way to make the orange star-rectangle shape symmetrical?

    In the tutorial, after joining the orange rectangle and stars and going back in to reshape the points, is there a way to make sure the shape is symmetrical (such as just by changing one side and then automatically applying the same angles to the other side)?

    Lysie,
    Without knowing anything about the tutorial or the specific case, but presuming symmetry to start with and that you wish to move individual Anchor Points on one side and have the mirrored movements on the other side:
    Normally, when you wish to create something mirrored, you work with half the shape and have it reflected (which can be done live), but when you have both sides already, maybe it is better to mirror by repeating.
    For each set of Anchor Points, you may (after initially deselecting):
    1) With the Direct Selection Tool ClickDrag the Anchor Point to a new position on one side;
    2) Click the corresponding Anchor Point on the other side and Ctrl/Cmd+Shift+M (Object>Transform>Move) keeping the values and only changing the sign for Horizontal (from + to - or - to +).
    If you need to move the same Ancjor Point multiple times, perform both 1) and 2) each time.

  • Is there a way to make the arrow keys scroll through a page (webpage or other)? Lately, it seems to go right from the top of the page to the bottom, skipping everything in between.

    Is there a way to make sure the arrow keys scroll through a page rather than jumping from the top to the bottom?

    It is kind of strange that the files are not being overwritten. If you publish to a local folder and upload with an FTP app you should be able to set this to over write the old files.
    http://www.iwebformusicians.com/iWeb/Publish-Website.html
    http://www.iwebformusicians.com/Search-Engine-Optimization/Upload.html

  • In LabVIEW6i, is there a way to make particular elements of an array invisible while the others stay visible (without losing any element's info.)?

    I have an array of clusters. Each cluster pertains to a certain oscilloscope I am controlling. There is another control which specifies which oscilloscopes I have "on".
    If a particular oscilloscope is "on" I want its cluster to be VISIBLE in the array. If a particular oscilloscope is "off" I want its cluster to be INVISIBLE in the array.
    How can I implement this in my program without losing ANY of the info. in my array?

    I suggest to use two arrays; one for user interface holding the ON clusters,
    and one for internal use holding all clusters. The diagram periodically
    updates the internal array with user interface array data.
    By INVISIBLE do you mean "skipped from the array" or displayed as an empty
    placeholder? To hide an OFF cluster you could put in the cluster a flat
    button boolean that is small and transparent when ON and large enough to
    cover the whole cluster area (and other controls) when OFF.
    Jean-Pierre Drolet
    Scientech R&D
    "mcmastal" a écrit dans le message news:
    [email protected]..
    > In LabVIEW6i, is there a way to make particular elements of an array
    > invisible while the others stay visible (without losing any element's
    > info.)?
    >
    > I have an array of clusters. Each cluster pertains to a certain
    > oscilloscope I am controlling. There is another control which
    > specifies which oscilloscopes I have "on".
    > If a particular oscilloscope is "on" I want its cluster to be VISIBLE
    > in the array. If a particular oscilloscope is "off" I want its
    > cluster to be INVISIBLE in the array.
    > How can I implement this in my program without losing ANY of the
    > info. in my array?
    LabVIEW, C'est LabVIEW

  • Is there a way to make Photoshop Elements 5 (2006) compatible to a Dell Windows 7 laptop?

    I received a copy of Photoshop Elements 5 (2006) and have a Dell Windows 7. I installed and registered my name to the software, but am aware that the program is compatible with Windows Vista or XP. Is there a way to make it compatible to my computer and/or update/upgrade to a more recent version? If there is no way to make the program work for my computer, is there a way to un-register my name from it?
    Thank you for any help at all!
    -Blair Gorman

    Do you get any problems when trying to run the software on Windows 7?  If yes, try to run it under Windows XP or Vista Compatibility Mode.

  • Is there a way to make the colour picker in the toolbar bigger?

    Hi,
    Is there a way to make the colour picker in the toolbar bigger?
    I've been using Illustrator for some time now and find this part of the software to be annoying as I frequently mis-click this tiny area and the switching between foreground and background colour is easily mismanaged and you end up changing the colour of the one you didn't intend and then have to make two clicks to remedy that.
    Do any other users find this to be a badly designed part of the software?
    Also, while I'm here I suggest that when in the colour creation dialogue the 'preview' tick can somehow be switched to on as default.
    I can understand that there are situations where it might be better not to see your colour change in the document in real time, but to have to click this (again very small) tick box again and again feels like bad design.
    ^ both the above are frequent tasks for many users
    Interested to hear if there's any work arounds to fix this.

    Thanks for the tip,
    I do use x and shift x and also / to make a no stroke or no fill. But / is a long way across the keyboard. I guess I could reassign that function to a key that's nearer x.
    I think the real annoying bit is not only the small size of the two overlapping squares, but the fact that they change size depending on which one is selected. So the button that is not selected is encroached by the one that is selected (and overlaps it). This to me seems counter to interface design - ie, make the switch button smaller. Worse still is the no fill / no stroke button; insanely tiny.
    I would gladly redesign this corner of Illustrator for Adobe, and I'm sure quite a few other people would too!

  • Is there a way to work with two or more app at the same time on iPhone or iPad

    Is there a way to work with two or more app at the same time on iPhone or iPad?

    What i am attempting to achieve is to work with at least two app at the same time. For example: select any picture from my albums to attach them in an email. Another example is get data from an app to use it with the calc app. And there are more exaples for it. And for sure I need support for an iPad air. I mencioned the other tablet just to try to be a bit clearer.

  • Is there any way to make the sent folder in mail list emails "to" instead of  "from"

    Is there any way to make the sent folder in mail list emails in the "to" order instead of  "from".

    Sure open Sent folder.
    Just above first message is an icon titled Sort By Date followed by a downward pointing arrow.
    Click on the arrow and select "To" from the list.
    Allan

  • I share a photo stream with a family member. Is there a way to make it so we have separate photo stream but still use the same apple id?

    i share a photo stream with a family member. Is there a way to make it so we have separate photo stream but still use the same apple id?

    You'll want a separate iCloud account for each user in addition to the main Apple ID used for purchases.
    Let's say you have a family of four (husband, wife, and two children). Here is what you will need:
    Main Apple ID for shared purchases in Tunes (everybody will be using this)
    iCloud (Apple ID) account for husband
    iCloud (Apple ID) account for wife
    iCloud (Apple ID) account for child 1
    iCloud (Apple ID) account for child 2
    Yes, you can have both an Apple ID and iCloud account setup on the same device. On each iOS device, setup the main Apple ID account for the following services:
    iCloud (Photo Stream and Backup are the only items selected here).
    Music Home Sharing
    Video Home Sharing
    Photo Stream
    Additionally, on each iOS device, add a new iCloud account (Under Mail, Contacts, Calendar) that is unique to each user for the following services:
    Mail (if using @me.com)
    Contacts
    Calendars
    Reminders
    Bookmarks
    Notes
    Find My iPhone
    Messages
    Find Friends
    FaceTime
    On your individual Macs (or Mac accounts), use the main Apple ID in iTunes. Then, use the unique iCloud account in/for iCloud.
    Now that everbody is using separate iCloud accounts for your contacts, calendars, and other things, it will be all be kept separate.
    The only thing that is now 'shared' would be iTunes content (apps and other purchases), backups via iCloud (if enabled), and Photo Stream (if enabled).

Maybe you are looking for

  • Bex transport  in SAP BW 3.1

    Hello everybody, how do you organize Bex transport in SAP BW? In our installation, we find it necessary that some queries need to be designed in development system and tested before transport in production. We would like the person who's creating the

  • Set of Books not showing in list of values - 11i

    Hi all, I have an issue with Set of books, i have followed one note and created a set of books. After that tried to create one inventory organization, then tried to create operating unit, there Legal Entity is showing but when click set of book, show

  • Workflow Question

    Hi, I have a quicktime self contained movie I've exported from FCP. It's just over 6 hours long (it's a seminar). The file size is 34 gigs. It's 854x480 Apple Intermediate Codec, Linear PCM bitrate 14,176 Does anyone have a workflow suggestion for me

  • Mapping users from resources to user in IDM

    Hi I have a user say tom123 in Windows NT and the same user also exists in LDAP with accountid tom1. How do i load them into IDM as a single user with different resources? Any ideas are appreciated

  • Ford Sync & Bluetooth Settings

    Hi! I've only had Sync for a couple of weeks, so forgive me for being a newbie. I setup my iPhone 4 perfectly, playing music through USB and phone services through Bluetooth. The other day, I decided to listen to music through Bluetooth, and ever sin