Results 1 to 4 of 4
  1. #1
    vanilla88 is offline Member
    Join Date
    Sep 2011
    Posts
    1
    Rep Power
    0

    Default HELP! not sure how to create random Array

    Please help me I'm having trouble writing this code:

    1) Generate random exam score in the range of [0,200] for 11 students and stores it in an array of doubles.

    how to create a random array?
    Any help would be much appreciated. Thanks

  2. #2
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    620
    Rep Power
    4

    Default Re: HELP! not sure how to create random Array

    Use Random class.
    Skype: petrarsentev
    http://TrackStudio.com

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default Re: HELP! not sure how to create random Array

    how to create a random array
    The array would need one slot for each student's score.
    Then use the Random class to assign a random score to each student's slot.

  4. #4
    FlyNn is offline Senior Member
    Join Date
    Feb 2010
    Posts
    128
    Rep Power
    0

    Default Re: HELP! not sure how to create random Array

    Here's some pseudo code to get you started:

    Declare variable to hold total count of students;
    Declare an EMPTY array of type double. Dont forget make it size 10;

    Run a for loop while count<stud_array.length(){
    inside the for loop generate the random value and add it to the array;
    }
    Measuring programming progress by lines of code is like measuring aircraft building progress by weight.

Similar Threads

  1. Pick a random value from array?
    By RattleSnake in forum New To Java
    Replies: 2
    Last Post: 04-26-2011, 05:36 AM
  2. Help with random bits array
    By AnimeKitty in forum New To Java
    Replies: 11
    Last Post: 07-30-2010, 04:37 AM
  3. Hello? How to Create Random access???
    By Miyaki in forum New To Java
    Replies: 1
    Last Post: 03-05-2009, 06:37 AM
  4. 2D Array Random Shuffle
    By Nuluvius in forum New To Java
    Replies: 8
    Last Post: 11-23-2008, 06:15 PM
  5. How to get a random value in an array
    By Franneldort in forum New To Java
    Replies: 21
    Last Post: 11-01-2008, 02:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •