Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Problems with this code?

  1. #1
    Junior Member
    Join Date
    Oct 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Problems with this code?

    package ArrayGenerator;


    import java.util.Arrays // in order to be able to use the fill(...) method

    public class SimpleRandomCount extends RandomCount
    {
    /**
    * Constructor
    */
    public SimpleRandomCount(int size) {
    super(size);
    }

    /**
    * Randomise the array
    */
    protected void randomise() {
    int[] copy = new int[];
    // used to indicate if elements have been used
    boolean[] used = new boolean[array().length];
    Arrays.fill(used,false);
    for (int index = 0; index < array().length {
    do {
    randomIndex = randomIndex();
    } while (used[randomIndex]);
    copy[index] = array[randomIndex];
    used[randomIndex] = True;
    }
    for (index < array().length; index++) {
    array()[index] = copy[index];
    }

    } End of class SimpleRandomCount


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 697 Times in 679 Posts

    Default Re: Problems with this code?

    Welcome to the Forum! Please read this topic to learn how to post code correctly and other useful tips for newcomers.

    Please post your code correctly per the above link and ask a specific question. If you're getting errors, post the complete text of the error message. We won't grade or debug your work for you, especially when it's posted incorrectly.

Similar Threads

  1. Code problems! HELP :)
    By adi2609 in forum What's Wrong With My Code?
    Replies: 14
    Last Post: March 19th, 2013, 03:22 PM
  2. Code problems
    By Alucard2487 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 27th, 2013, 05:02 PM
  3. problems with my code
    By poppe in forum What's Wrong With My Code?
    Replies: 4
    Last Post: January 26th, 2012, 09:10 AM
  4. Problems with my code
    By poppe in forum Member Introductions
    Replies: 1
    Last Post: January 26th, 2012, 04:53 AM
  5. Problems with a code
    By oriol in forum What's Wrong With My Code?
    Replies: 3
    Last Post: December 9th, 2011, 07:02 PM