Results 1 to 2 of 2
  1. #1
    rootpi is offline Member
    Join Date
    Dec 2009
    Rep Power

    Default Adjusting function

    Hey, we have to make a program that adjusts a given function. First of all, we have to generate many points uniformily distributed along the [0,1] interval.
    They give us as a hint to use the

    Java Code:
    to do it, but it always give us an error.

    Which is the problem?

    By the moment we have:

    Java Code:
    for (int n = 3; n < 4; n++) { 
                double a = 1 + (2 * n); //function to adjust.
                double[] matriuX = new double[n]; 
                double[] matriuY = new double[n]; 
                for (int i = 0; i < matriuX.length; i++) { 
                    double b = (Random.nextGaussian()); 
                    matriuX[i] = b;

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    You're calling Random#nextDouble() and Random.nextGausian() as if they were static methods called off of the Random class. They aren't, and so you must first create a Random object, and then call the method off of this object.

    BTW, what is your exact error here(it's always a good idea to post it here)? Isn't it already telling you not to call the method as a static?

Similar Threads

  1. Replies: 4
    Last Post: 01-21-2010, 05:46 PM
  2. Replies: 3
    Last Post: 12-04-2009, 03:08 PM
  3. function
    By nanna in forum New To Java
    Replies: 1
    Last Post: 11-17-2008, 09:20 PM
  4. Need help with get function
    By calicocal in forum New To Java
    Replies: 10
    Last Post: 11-09-2008, 07:59 PM
  5. Need a little help with a function!
    By Nuluvius in forum New To Java
    Replies: 3
    Last Post: 02-07-2008, 11:33 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