Generate a new (random) mine field?? for minesweeper

I have to create a minesweeper game for my java class.
but im having trouble creating the method to generate a random mine field?!?!
(i dont even know where to start)
public static boolean [][] generateMineField ( int length, int width, int numberMines)This method generates a new mine field as a matrix of boolean values where a cell is set to "true" to indicate the presence of a mine. The length and the width of the field are provided, and also the desired number of mines (numberMines).
Hint: Use Math.random(), Math.floor(), and type cast to generate random positions for the mines.
ThanK You!

One thread is enough...
[http://forums.sun.com/thread.jspa?threadID=5347127&tstart=0]

Similar Messages

  • How to generate a new segment in IDoc for multiple occurance of Control Num

    Hi Experts,
    In my scenario, i need to generate a new segment in IDoc(Target Structure) based on  Control Number Field in the Source Structure.
    The segment need to be created for multiple occurance of the Control Number.
    Ex:
    Control Number - 100 appears 5 times in Source Structure.This control Number is mapped to one of the Field in the Segment of  IDoc.
    Now my requirement is to generate the Segment 5 times with respective to this Control Number.
    please help me out to resolve this issue.
    Thanks,
    Kish.

    Hi,
    Here is the XML Structure of my Source:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:GoodsReceipt_MT xmlns:ns0="urn:WOL-com:XI:data:HJ:10">
       <row>
          <CONTROL_NUMBER>111</CONTROL_NUMBER>
          <LINE_NUMBER>1111</LINE_NUMBER>
          <CONTROL_NUMBER_2/>
          <OUTSIDE_ID/>
          <WH_ID>111111</WH_ID>
          <LOCATION_ID/>
          <HU_ID>11111</HU_ID>
          <NUM_ITEMS/>
          <ITEM_NUMBER>111111</ITEM_NUMBER>
          <CONTROL_NUMBER_3>LR</CONTROL_NUMBER_3>
          <LOT_NUMBER>11111</LOT_NUMBER>
          <UOM>11111</UOM>
       </row>
       <row>
          <CONTROL_NUMBER>111</CONTROL_NUMBER>
          <LINE_NUMBER>12222</LINE_NUMBER>
          <CONTROL_NUMBER_2/>
          <OUTSIDE_ID/>
          <WH_ID>12222</WH_ID>
          <LOCATION_ID/>
          <HU_ID>1222</HU_ID>
          <NUM_ITEMS/>
          <ITEM_NUMBER>112222</ITEM_NUMBER>
          <TRAN_QTY>112222</TRAN_QTY>
          <CONTROL_NUMBER_3>LR</CONTROL_NUMBER_3>
          <LOT_NUMBER>12222</LOT_NUMBER>
          <UOM>1122222</UOM>
       </row>
       <row>
          <CONTROL_NUMBER>222</CONTROL_NUMBER>
          <LINE_NUMBER>2222</LINE_NUMBER>
          <CONTROL_NUMBER_2/>
          <OUTSIDE_ID/>
          <WH_ID>22222</WH_ID>
          <LOCATION_ID/>
          <HU_ID>222222</HU_ID>
          <NUM_ITEMS/>
          <ITEM_NUMBER>2222222</ITEM_NUMBER>
          <TRAN_QTY>22222222</TRAN_QTY>
          <LOCATION_ID_2>33333333</LOCATION_ID_2>
          <CONTROL_NUMBER_3>LR</CONTROL_NUMBER_3>
          <LOT_NUMBER>22222</LOT_NUMBER>
          <UOM>22222</UOM>
       </row>
       <row>
          <CONTROL_NUMBER>333</CONTROL_NUMBER>
          <LINE_NUMBER>3333</LINE_NUMBER>
          <CONTROL_NUMBER_2/>
          <OUTSIDE_ID/>
          <WH_ID>33333</WH_ID>
          <LOCATION_ID/>
          <HU_ID>33333</HU_ID>
          <NUM_ITEMS/>
          <ITEM_NUMBER>333333</ITEM_NUMBER>
          <TRAN_QTY>33333333</TRAN_QTY>
          <CONTROL_NUMBER_3>LR</CONTROL_NUMBER_3>
          <LOT_NUMBER>33333</LOT_NUMBER>
          <UOM>333333</UOM>
       </row>
    </ns0:GoodsReceipt_MT>
    Now Control_Number 111 occurs 2 times, 222 & 333 occurs 1 time.
    Now one IDoc for 111,222 & 333 should be generated.
    But Control_number 111 appears 2 times.
    Now the data in the 2 rows should be passed to Single IDoc by repeating the segments inside the IDoc.
    As u said i changed the Occurance of IDoc to 0...unbound and imported as External Definition. I have done upto Generating IDoc for each unique Control_Number.
    I stuck up at repeating the Segments in the IDoc.
    So please help me out.
    Thanks,
    Kish.

  • Is new Mac mini ok for Adobe CS6

    I have an early 2009 24inch iMac (2.66 GHz, 4Gb Ram). I mainly use the core CS6 programmes (InDesign/Illustreator/Acrobat/Photoshop). I sometimes get given psd files that are huge, multi layered - perhaps 300 to 400Mb. I may have to open them up and do minor changes like deleting layers or retouching. My iMac struggles.
    So I'm thinking it's time for an upgrade. I had been considering the new 2012 2.9Ghz 27inch Corei5 iMac but the 2012 2.6Ghz Corei7 Mac Mini looks tempting. Whichever I opt for I will put in 16Gb Ram. The question is - will the Mac Mini have enough power for what I want to do and how significant is the fact that its an integrated Graphics Card (HD4000) rather than a discrete card - I assume either would be better than what I have. There are loads of questions on various forums but most people seem concerning with gaming which is not something it will be used for.

    Jeffrey, can you clarify how a Photoshop user should evaluate GPU RAM when shopping for a computer with integrated graphics? For example, Apple's tech specs for the Mac mini do not list the amount of VRAM for the Intel HD Graphics 4000 used in the mini, presumably because system RAM is used. Adobe's Tested Video Cards for Photoshop CS6 list doesn't seem to be updated for the new 512MB requirement for 3D, and the list of supported graphics cards doesn't make a distinction between GPUs that have less than or more than 512MB.
    In an Apple forum I found a post claiming that if a Mac with Intel HD 4000 graphics has less than 8GB RAM the integrated graphics get 384MB of VRAM, and if the Mac has 8GB RAM or more the integrated graphics get 512MB of VRAM. It was a posting from a user, so do you know if that claim is true, and if there is another RAM breakpoint where the integrated graphics could gain use of 1GB or 2GB of VRAM?
    And following up to that, is there any way to use a utility or a Terminal command to manually assign system RAM to Intel integrated graphics?

  • Create new random password

    Hi,
    I use PHP and MySQL within Dreamweaver
    I want my client to be able to generate a new random password
    for a new member.
    How should I do this?
    Create a list of random passwords or
    can I create it on the fly while registering a new member?
    I don't want the new member to create his own password.
    Thanks to all people contributing to this forum.
    I learned a lot here allready.
    I hope you can also help me out with this one.
    Jos

    > can I create it on the fly while registering a new
    member?
    That would be the best way.
    I have used this to produce random, 8 character passwords
    (the database part
    is to make sure that they are unique) -
    function randomkeys($length)
    $pattern =
    "234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    for($i=0;$i<($length);$i++)
    if(isset($key))
    $key .= $pattern{rand(0,strlen($pattern)-1)};
    else
    $key = $pattern{rand(0,strlen($pattern)-1)};
    return $key;
    mysql_select_db($database_selectData, $selectData);
    $query_rsPasswords = "SELECT contactPassword FROM
    tblcontactdata";
    $rsPasswords = mysql_query($query_rsPasswords, $selectData)
    or
    die(mysql_error());
    $row_rsPasswords = mysql_fetch_assoc($rsPasswords);
    $totalRows_rsPasswords = mysql_num_rows($rsPasswords);
    $masterList=array();
    $passwords=array();
    $rsPasswordList = mysql_query("SELECT contactPassword FROM
    tblcontactdata",$selectData)
    or die(mysql_errno()." : ".mysql_error());
    while ($rec = mysql_fetch_row($rsPasswordList)){
    $passwords[] = $rec[0];
    $unique = false;
    while ($unique === false) {
    $temp = randomkeys(8); // this is generating a random
    8-character p/w
    if(!in_array($temp, $passwords)) {
    $newPassword = $temp;
    $unique = true;
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "arnhemcs" <[email protected]> wrote in
    message
    news:[email protected]...
    > Hi,
    >
    > I use PHP and MySQL within Dreamweaver
    > I want my client to be able to generate a new random
    password for a new
    > member.
    >
    > How should I do this?
    > Create a list of random passwords or
    > can I create it on the fly while registering a new
    member?
    > I don't want the new member to create his own password.
    >
    >
    >
    >
    > Thanks to all people contributing to this forum.
    > I learned a lot here allready.
    >
    > I hope you can also help me out with this one.
    >
    > Jos
    >

  • What is the white horizontal line and red vertical line on my brand new ipad mini?

    Bought a brand new ipad mini 2 for my sons Christmas, took it out the box and it was during the set up process, ie entering his iTunes and icloud account, a white horizontal line and a red vertical line appeared on the screen and is there all the time now.  Have tried switching off and on and resetting, but it is still there.  Any ideas??

    Hi Tolmivooz,
    So the lines didn't appear until you were into the setup?
    Does the orientation of the lines change when you rotate the screen?
    Thanks for trying the restart and reset. Please see if a restore helps.
    Get help with the screen on your iPhone, iPad, or iPod touch - Apple Support
    If you see lines, missing sections, discoloration, or poor image quality
    Try to restart your device. If you can't restart, reset your device.
    If restarting or resetting doesn’t fix the issue, restore your device.
    If you still see the issue after you restore, contact Apple Support.
    Best,
    Nubz

  • How to connect an old ADC flat panel to the new Mac mini?

    I am thinking of getting one of these new Mac mini's for the kids in the den and I have an old 20" flat panel ADC from Apple that is still going strong. Is there an adapter that will work with this configuration?
    Thanks,
    West

    Somewhat ungainly, but you'll need the mini-DVI-DVI adaptor (supplied with the new mini), and a DVI-ADC adaptor (http://store.apple.com/us/product/M8661LL/B?fnode=MTY1NDA5OQ&mco=MjE0NTg4NA)

  • No video on brand new mac mini

    I am trying to get a brand new mac mini going for the first time, and although it switches on, there is no video on the attached VGA display.
    I have connected the same display to my Ibook VGA adapter and it works perfectly, so it is not the display. I have also tried another display which also works on the I book. What else can I do other that take it into a mac store as I am a very long way from one?

    Here is an assortment of Apple technical articles dealing with this sort of thing. Good luck.
    http://docs.info.apple.com/article.html?artnum=300583
    http://docs.info.apple.com/article.html?artnum=300537
    http://docs.info.apple.com/article.html?artnum=300580

  • New mac mini server won't start up

    Hi I've had the new Mac mini server for 2 day now and it was workinf fine untill I tried to restart it. When I turn it on I just get the apple logo and the gray processing wheel.
    I've have used disc utility to check the disc. But that did nothing.
    It is picking up the startup disc fine.
    Is there anything I can do or will I need to re-install.
    Any help would be appreciated.
    thanks

    Greetings Richard, I ran into a similar situation recently with my mini server. although I believe it to be a problem of my DNS settings getting hosed. I couldn’t log in no matter what log I used-even as the root user.
    I had a back up on the second drive of the mini. I did buy the USB drive when I bought the mini, so I was able to boot off the install disc. Then from the menu I choose the back up partion as the start up drive. After restarting, I was at least able to recover and copy my important files to the back up partition. I have not been able to work out the login issue yet. I’ll probably just do a reinstall on the corrupted drive.
    In any event, it maybe worth it for you to buy the USB drive and boot off of it.
    The verbose mode is for you to be able to login through the command line and trouble shoot from there.
    Also, in safe mode, any files that you may want to change permissions, you may need to change the owner and then change the permissions. This is done with the chown command and then chmod command. You’ll need to use the sudo command so you can become the root user to use the commands and make any changes.
    Hope this will at least help you get further in troubleshooting this issue.
    Bill B

  • I cannot sign onto Facetime with new iPad mini 3

    Recently purchased 2 new iPad mini 3 for children.  Update iOS to 8.2.  Family share and parental controls are set.  One iPad mini 3 will sign in, one will not.  I have gone through most every "trick" or "fix" I could find (OFF & ON, Sign out & Sign In, Checked Date & Time, set DNS to 8.8.8.8, etc.) to get the one iPad to sign in but no use.  Other than a complete factory reset, I have run out of ideas.  Is there some child age restriction possibly I don't know about keeping it from signing in?  Any other "try this" ideas the community can share?  Thanks in advance

    I have tried the factory reset and it did not work. The people at the Apple Store thought I needed a replacement iPad but I think it's an Apple problem. I got bumped up to a senior tech at AppleCare who is working with engineers. There are a number of people with this problem.
    have you sen the long post about this?
    https://discussions.apple.com/thread/6789149

  • NEW IPAD MINI REQUESTING PASSCODE

    I gave my wife a new ipad mini yesterday for her birthday and when turning on the pad this morning it is asking for a passcode.  we never set one up.  how do we get into our new ipad

    Return it from wherever you bought it and get another one.

  • I received an iPad Mini today for my birthday

    Alright so, as the subject says, I got a new iPad Mini today for my birthday. At first it was working perfectly. I was able to connect to the network, download a few apps and then all of a sudden, it lost connection. I tried multiple times to get it to connect again. Nothing. So I went online and tried different things; resetting network settings, resetting general settings but nothing worked. So I went on the Apple website and chatted with someone. They had me update the software (it starts off with 6.1.2 I think, so I updated to 6.1.3). After that, it worked perfectly again...for a while. Once again, I lost connection. Tried resetting the router, resetting everything again. But nothing worked. So I got on the Apple site again, and was told that it was a hardware issue and to exchange it. So I did, and the new one doesn't connect either. Now I'm ****** and about to say screw you Apple, but when the iPad was working I loved it too much to do so. Any suggestions or comments or solutions? It would be greatly appreciated. Thanks

    Some things to try first:
    1. Turn Off your iPad. Then turn Off (disconnect power cord for 30 seconds or longer) the wireless router & then back On. Now boot your iPad. Hopefully it will see the WiFi.
    2. Go to Settings>Wi-Fi and turn Off. Then while at Settings>Wi-Fi, turn back On and chose a Network.
    3. Change the channel on your wireless router (Auto or Channel 6 is best). Instructions at http://macintoshhowto.com/advanced/how-to-get-a-good-range-on-your-wireless-netw ork.html
    4. Go into your router security settings and change from WEP to WPA with AES.
    5.  Renew IP Address: (especially if you are droping internet connection)
        •    Launch Settings app
        •    Tap on Wi-Fi
        •    Tap on the blue arrow of the Wi-Fi network that you connect to from the list
        •    In the window that opens, tap on the Renew Lease button
    6. Potential Quick Fixes When Your iPad Won’t Connect to Your Wifi Network
    http://ipadinsight.com/ipad-tips-tricks/potential-quick-fixes-when-your-ipad-won t-connect-to-your-wifi-network/
    ~~~~~~~~~~~~~~~~~~~~~~~~~
    Wi-Fi Fix for iOS 6
    https://discussions.apple.com/thread/4823738?tstart=240
    iOS 6 Wifi Problems/Fixes
    How To: Workaround iPad Wi-Fi Issues
    http://www.theipadfan.com/workaround-ipad-wifi-issues/
    Another Fix For iOS 6 WiFi Problems
    http://tabletcrunch.com/2012/10/27/fix-ios-6-wifi-problems-ssid/
    Wifi Doesn't Connect After Waking From Sleep - Sometimes increasing screen brightness prevents the failure to reconnect after waking from sleep. According to Apple, “If brightness is at lowest level, increase it by moving the slider to the right and set auto brightness to off.”
    Fix For iOS 6 WiFi Problems?
    http://tabletcrunch.com/2012/09/27/fix-ios-6-wifi-problems/
    Did iOS 6 Screw Your Wi-Fi? Here’s How to Fix It
    http://gizmodo.com/5944761/does-ios-6-have-a-wi+fi-bug
    How To Fix Wi-Fi Connectivity Issue After Upgrading To iOS 6
    http://www.iphonehacks.com/2012/09/fix-wi-fi-connectivity-issue-after-upgrading- to-ios-6.html
    iOS 6 iPad 3 wi-fi "connection fix" for netgear router
    http://www.youtube.com/watch?v=XsWS4ha-dn0
    Apple's iOS 6 Wi-Fi problems
    http://www.zdnet.com/apples-ios-6-wi-fi-problems-linger-on-7000004799/
    ~~~~~~~~~~~~~~~~~~~~~~~
    How to Boost Your Wi-Fi Signal
    http://ipad.about.com/od/iPad_Troubleshooting/a/How-To-Boost-Your-Wi-Fi-Signal.h tm
    Troubleshooting a Weak Wi-Fi Signal
    http://ipad.about.com/od/iPad_Troubleshooting/a/Troubleshooting-A-Weak-Wi-Fi-Sig nal.htm
    How to Fix a Poor Wi-Fi Signal on Your iPad
    http://ipad.about.com/od/iPad_Troubleshooting/a/How-To-Fix-A-Poor-Wi-Fi-Signal-O n-Your-iPad.htm
    iOS Troubleshooting Wi-Fi networks and connections  http://support.apple.com/kb/TS1398
    iPad: Issues connecting to Wi-Fi networks  http://support.apple.com/kb/ts3304
    WiFi Connecting/Troubleshooting http://www.apple.com/support/ipad/wifi/
    How to Fix: My iPad Won't Connect to WiFi
    http://ipad.about.com/od/iPad_Troubleshooting/ss/How-To-Fix-My-Ipad-Wont-Connect -To-Wi-Fi.htm
    iOS: Connecting to the Internet http://support.apple.com/kb/HT1695
    iOS: Recommended settings for Wi-Fi routers and access points  http://support.apple.com/kb/HT4199
    How to Quickly Fix iPad 3 Wi-Fi Reception Problems
    http://osxdaily.com/2012/03/21/fix-new-ipad-3-wi-fi-reception-problems/
    iPad Wi-Fi Problems: Comprehensive List of Fixes
    http://appletoolbox.com/2010/04/ipad-wi-fi-problems-comprehensive-list-of-fixes/
    Connect iPad to Wi-Fi (with troubleshooting info)
    http://thehowto.wikidot.com/wifi-connect-ipad
    Fix iPad Wifi Connection and Signal Issues  http://www.youtube.com/watch?v=uwWtIG5jUxE
    Fix Slow WiFi Issue https://discussions.apple.com/thread/2398063?start=60&tstart=0
    How To Fix iPhone, iPad, iPod Touch Wi-Fi Connectivity Issue http://tinyurl.com/7nvxbmz
    Unable to Connect After iOS Update - saw this solution on another post.
    https://discussions.apple.com/thread/4010130
    Note - When troubleshooting wifi connection problems, don't hold your iPad by hand. There have been a few reports that holding the iPad by hand, seems to attenuate the wifi signal.
    Wi-Fi or Bluetooth settings grayed out or dim
    http://support.apple.com/kb/TS1559
    ~~~~~~~~~~~~~~~
    If any of the above solutions work, please post back what solved your problem. It will help others with the same problem.
     Cheers, Tom

  • New Mac Mini won't recognize passcode for wireless keyboard

    Just unboxed my new Mac Mini and have started the install process.  Made it to the wireless mouse ok, then the keyboard.  It finds the keyboard, gives me the passcode, then I enter it and press enter as requested, and nothing happens.  It just spins through the process again and again.  I have installed new batteries, turned all things on and off at random, and turned off bluetooth on all other devices that might be interfering.  Any ideas?

    Take the batteries out of the keyboard
    Turn off the computer
    Put batteries back in keyboard and hit the power button on the side
    wait 5 seconds
    turn on mini
    go back through the setup process
    works every time for me

  • Generate a new version for PO header text change

    Hi,
    Could you pls instruct me the configuration settings to generate a new version for PO header text change? I secceeded in other fields, e.g. Inco Term, Order Qty, Delivery date, but failed in header and Item  Text.
    I added STXH_TDNAME but it doesn't work. Thanks!
    Regards
    Jully

    Hi,
    Thank you very for the feedback.
    The 4th point of note 664928 says "This is not a change to print-relevant texts". I assume there is a way to configure the text as a "print-relevant text" and I confirmed my texted is configured for printing for operation 1 & 2 (create and change order) in:
    MM > Purchasing > Messages > Texts for Messages > Define Texts for Purchase Order.
    Still not working. Any idea? Do I miss anything? Thanks!
    QUOTE of note 664928 :
    Question:
    You change the texts in a purchase requisition or a purchasing document. Why does the system not generate a new version?
    Answer:
    This is not a change to print-relevant texts.
    Regards,
    Jully

  • New fields for Attributes Data Tab  in Org Model

    Hi, Guru's
    I want to add/remove a new fields for Org model --->Attributes data tab
    Diivision
    Currency
    region
    dist.chnl
    like that I want to add another new XXXX and respected values
    How it would be done.
    Regards
    CR Gupta

    Thank you.
    I didn't get get the final Object
    Can any one give solution.
    system automatically generating the Table = HRT1222 and Field = LOW,
    But
    I need to maintain some values and to be select one from that list.
    How can I overcome ?
    Thank You.
    Edited by: CR.Gupta on Oct 1, 2011 7:53 PM

  • Date fields for info structure S032 are not generated

    Hi Experts,
    I am trying to update set up tables for '02'  using OLI2BW. I excluded some plants from selection and executed the set up. But the job run for few mins and completed with the message "Date fields for info structure S032 are not generated".
    I couldn't see any records in RSA3.
    Please through some light on this issue.
    Points reward for usefull help.
    Please no wild guess.
    Regards,
    -N-

    Did you find out why. I am getting same message.
    Thanks
    Shalini

Maybe you are looking for

  • Japanese Data Set and Get Problem with SQL

    Hi, I am not able to retrieve or set data contain Japanese characters. Formerly our set up was running just fine. But on doing installation on a new machine, things have gone all haywire. I installed Win NT 4.0 Japnese version and SQL 7.0 and later W

  • Word Mole for Mac

    Anyone know how I can download Word Mole for my Mac?

  • What is on my Mac Book's HD after Lion Installation

    Hi, all, a retrospective newbie query, after an apparently successful Lion 10.7 installation. On snooping around my Mac Book's HD, I found - Applications Install.341HIM0FB (opens up  > private > tmp) Install.342xzxGUj   (opens up > ditto) Library Sys

  • Custom Taglets and static class fields/methods...

    Hey all, I have a curiosity question (running winxp + j2sdk 1.4.2_04). I have written a few stand-alone and inline taglets to help me document my code. I had some problems initially getting the HTML to output correctly (and I don't know how to run ja

  • Iphoto calendar

    I would like to insert some photos in portrait format into my iphoto calendar, but I am only given templates(under layout)  for landscape orientation.Is this possible?