Question about Computers & Internet

1 Answer

I am using Raptor (June 24, 2008) version and cannot solve a problem I have been asked to do. I have been asked to simulate the process of dealing cards from a 52-card deck by generating 1,000 random integers in the range of 1 to 52. I should assume that numbers 1 to 13 are clubs, 14 to 26 are diamonds, 27 to 39 are hearts, and 40 to 52 are spades. I need to display the number of times each suit occurred in teh 1000 "deals". I should use the "floor" function in this answer... Can you help?

Posted by on

  • jscarbo124 Nov 12, 2009

    Thank you so much. I thought I needed to use Selection boxes for the four different sub-groups... but you're right... Counters for each suit is much better!!



1 Answer

  • Level 3:

    An expert who has achieved level 3 by getting 1000 points


    An expert that got 10 achievements.


    An expert that got 5 achievements.


    An expert who has written 7 tips or uploaded 3 video tips

  • Master
  • 1,049 Answers

Normal 0 false false false MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} The floor function rounds down to the nearest whole number, you use it to get an integer between 1 and 52, because a number like 52.7 would round up to 53. The program you want to make will work as follows.

  1. Start a loop with 1000 iterations
  2. Create a value and assign it a random number between 1 and 52
  3. Floor the value to make it a valid value
  4. If the number is 1 to 13 increment a clubs counter
  5. If the number is 14 to 26 increment a diamonds counter
  6. If the number is 27 to 39 increment hearts
  7. If greater than 39 increment spades
  8. Repeat next iteration
  9. Display your results.

Posted on Nov 12, 2009

  • NA NA
    NA NA Nov 12, 2009

    Ignoring the syntax, this might be more helpful to you...but I'm not a big Raptor user so don't try and copy this without some grammar checking, if you know what I mean. It's just a demonstration using generic code.

    int xDiamonds = 0
    int xSpades = 0
    int xHearts = 0
    int xClubs = 0

    for (i = 1; i < 1000; i++) {
    int xCard = rand(52)
    if (xCard < 14) { xClubs++ }
    if (xCard > 13 and xCard < 27) {xDiamonds++ }
    if (xCard > 26 and xCard < 40) {xHearts++ }
    if (xCard > 39) {xSpades++ }

    Then just do a print statement that you have xWhatever cards in i iterations.



1 Suggested Answer

  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi there,
Save hours of searching online or wasting money on unnecessary repairs by talking to a 6YA Expert who can help you resolve this issue over the phone in a minute or two.

Best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.

Here's a link to this great service

Good luck!

Posted on Jan 02, 2017


Add Your Answer

Uploading: 0%


Complete. Click "Add" to insert your video. Add



Related Questions:

1 Answer

Engine information 1965 Australian ford falcon

Ford Falcon Sedan 3.1-Litre 3-speed (XT), manufactured or sold in 1969, version for Australia (up to June)
  • 4-door sedan body type
  • RWD (rear-wheel drive), manual 3-speed gearbox
  • petrol (gasoline) engine with displacement: 3074 cm3 / 187.6 cui, advertised power: 85 kW / 114 hp / 116 PS ( SAE gross ), Torque net: 244 Nm / 180 lb-ft
  • characteristic dimensions: outside length: 4689 mm / 184.6 in, wheelbase: 2819 mm / 111 in
  • reference weights: base curb weight: 1324 kg / 2919 lbs
  • how fast is this car ? top speed: 149 km/h (93 mph) (theoretical);
  • accelerations: 0- 60 mph 14.2 s; 0- 100 km/h 15.3 s (a-c simulation); 1/4 mile drag time (402 m) 19.6 s (a-c simulation)
  • fuel consumption and mileage: average estimated by a-c: 14.4 l/100km / 19.6 mpg (imp.) / 16.3 mpg (U.S.) / 6.9 km/l
  • Feb 22, 2015 | Ford Cars & Trucks


    D3dx9_37 is missing?

    This is due to the fact that your Direct X 9 version is either out of date or just plain missing.
    The d3dx9_37.dll file is one of many similar files contained in the DirectX software collection. Because DirectX is used by most Windows based games and advanced graphics programs these errors usually show up when using these programs.

    To fix this it is as simple of downloading the latest version of DX9.
    Click here to go to FileHippo and get the June 2010 version. Click on the green arrow to the right to start the download.

    I've had many people ask me "how is this possible when I've just installed Windows Vista or even Windows 7." The simple answer is that when you install Windows Vista for example it ONLY installes Direct X10 components and when you install Windows 7 it ONLY installs DirectX 10 or 11. Therefore you will need to seperately download and install DirectX 9 in order to play games in DirectX 9 solve this problem.

    If installing the latest version of DirectX 9 doesn't solve the problem then do the following:
    • Explore the game CD you are trying to use and find the DirectX 9 version the game or program came with. Install this version.
    • Uninstall the game or software and then re-install it. One of the files associated with d3dx9_37 may have been overwritten or deleted by accident.
    • You could try extracting the d3dx9_37 from the DirectX 9 package and placing it where it needs to be.
    • Re-install or update your graphics card drivers.

    on Nov 14, 2010 | Computers & Internet

    1 Answer

    I want to actvate my city car driving simulator game which i had downloaded from the internet

    You're in the wrong forum. This area is for Dell laptops. You're asking for help with an app.

    Jun 29, 2014 | Dell Inspiron Computers & Internet

    1 Answer

    Pokemon raptor ex

    how do you get to use surf in the pc version of pokemon raptor ex?

    Oct 25, 2013 | Video Game Consoles & Games

    2 Answers

    I need to unlock the code juliette's fashion emphire

    Juliettes Fashion Empire 1.0 Simulations software developed by MyPlayBuscom. The license of this simulations software is freeware, the price is free, you can free download and get a fully functional freeware version of Juliettes Fashion Empire. Do not use warez version, crack, serial numbers, registration codes, pirate key for this simulations freeware Juliettes Fashion Empire. Always use genuine version that is released by original publisher

    hope it helps

    May 28, 2012 | Computers & Internet

    1 Answer

    Direct x problem for fsx

    Get rid of the pirated version, which is completely illegal and buy a proper copy and you will have no problem. If you try to register this software or update it, Microsoft will see it is a pirated copy and probably contact you with a law suit.

    Jan 10, 2009 | Microsoft Flight Simulator X for Windows

    2 Answers

    Unable to enter Subscription Key/Renewal Code

    The renewal should be under the help tab of the internet security main screen. After renewing, U should get an email with the new code to enter.

    May 26, 2008 | Computers & Internet

    1 Answer

    Problem entering Subscription Key/Reneewal Code

    try to enter the old serial number or reg key if it doesnt work then u go look for a crack or a back door.
    search in if ud find the crack or serial for it
    thank u

    May 26, 2008 | Computers & Internet

    Not finding what you are looking for?
    Computers & Internet Logo

    Related Topics:

    245 people viewed this question

    Ask a Question

    Usually answered in minutes!

    Top Computers & Internet Experts

    Les Dickinson
    Les Dickinson

    Level 3 Expert

    18424 Answers

    Doctor PC
    Doctor PC

    Level 3 Expert

    7733 Answers

    David Payne
    David Payne

    Level 3 Expert

    14162 Answers

    Are you a Computer and Internet Expert? Answer questions, earn points and help others

    Answer questions

    Manuals & User Guides