Results 1 to 10 of 10
  1. #1
    Tianma is offline Member
    Join Date
    Mar 2012
    Posts
    5
    Rep Power
    0

    Default Generate random number in evaluation score

    I have a reviewer r(i) has evaluated an object o(j), which is weighted with the assigned evaluation score e(i,j) ε[0,1]. The number of reviewers and objects are 10 each. My question is how to generate a random number with the fix number of reviewers per object at n=3. I mean each object should have evaluated only 3 reviewers.

    I am able to generate a random number with the following:

    Java Code:
    Random rand=new Random();     
     for(i=0; i<10; i++ ){        
       for(j=0; j<10; j++){                
           e[i][j]= rand.nextDouble();                
           System.out.println("e[" + i + "][" + j + "] = " +e[i][j]);
    
       }
    }
    Could you advince how to solve my problem?
    Thanks in advance!

  2. #2
    skynet357 is offline Member
    Join Date
    Mar 2012
    Location
    Hyderabad, India
    Posts
    8
    Rep Power
    0

    Default Re: Generate random number in evaluation score

    few questions.

    1. what is the use of the random number?? is it the score given by a evaluator??
    2. what is the significance of the term ε[0,1] mentioned in your post??

  3. #3
    Tianma is offline Member
    Join Date
    Mar 2012
    Posts
    5
    Rep Power
    0

    Default Re: Generate random number in evaluation score

    Quote Originally Posted by skynet357 View Post
    few questions.

    1. what is the use of the random number?? is it the score given by a evaluator??
    2. what is the significance of the term ε[0,1] mentioned in your post??
    1.Yes, it is the score given by evaluator. Frist, i want to random evaluator to the object, each object should have evaluated by 3 evaluator and then random the score to the object. Can u give me an idea?
    2. it's mean random sscore between 0 and 1.
    Last edited by Tianma; 03-09-2012 at 04:20 PM.

  4. #4
    skynet357 is offline Member
    Join Date
    Mar 2012
    Location
    Hyderabad, India
    Posts
    8
    Rep Power
    0

    Default Re: Generate random number in evaluation score

    step to get 3 random evaluators
    -------------------------------------------------
    1. im assuming that your evaluators are indexed from 0 to 9.

    2. using Math.random() method you can get a random double number 0<= e(0,1) >1.0 . multiply e(0,1) with 10 and use ceiling method to get random number between 0-9.

    3. Use the above step in a loop to get 3 such random number aka three random evaluators for each object.

    4. Getting random score shouldnt be a prob i guess. use any technique u want.


    hope it helps :) .. if i mentioned something wrong then please revert back.

  5. #5
    waiheng1986 is offline Member
    Join Date
    Mar 2012
    Posts
    6
    Rep Power
    0

    Default Re: Generate random number in evaluation score

    From you case, you should use the Math.random() to get the result in the range of 0<randomValue<1.
    Good luck.
    Last edited by waiheng1986; 03-12-2012 at 11:54 AM.

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

    Default Re: Generate random number in evaluation score

    Quote Originally Posted by waiheng1986 View Post
    you should use the Math.random()
    That was already said, so there was no point in repeating it -- unless maybe you were just looking for a chance to promote your blog. And, both times round, it's poor advice since the OP is already using the preferred java.util.Random.

    Quote Originally Posted by waiheng1986 View Post
    ... or you can PM me~
    Why? This is a forum, not a social networking site. Let's keep the discussions in the thread.

    Your blog is hopelessly outdated, by the way. Did you copy random (no pun intended) content from older sites or did you have a teacher who doesn't bother to update their knowledge and thinking?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  7. #7
    Tianma is offline Member
    Join Date
    Mar 2012
    Posts
    5
    Rep Power
    0

    Default Re: Generate random number in evaluation score

    Quote Originally Posted by skynet357 View Post
    step to get 3 random evaluators
    -------------------------------------------------
    1. im assuming that your evaluators are indexed from 0 to 9.

    2. using Math.random() method you can get a random double number 0<= e(0,1) >1.0 . multiply e(0,1) with 10 and use ceiling method to get random number between 0-9.

    3. Use the above step in a loop to get 3 such random number aka three random evaluators for each object.

    4. Getting random score shouldnt be a prob i guess. use any technique u want.


    hope it helps :) .. if i mentioned something wrong then please revert back.
    Thanks for your all reply. if i understand true your sleps and waiheng1986 are the same right? but i think it's different with my case. At my code above i was replaced i and j =4 instead of 10 because it's more short to show the output below:

    e[0][0] = 0.5209047579028665
    e[0][1] = 0.16964228925556757
    e[0][2] = 0.017109708977610216
    e[0][3] = 0.4459449995595135

    e[1][0] = 0.48018250929274686
    e[1][1] = 0.1467566990111293
    e[1][2] = 0.6720265277818704
    e[1][3] = 0.9081362342452916

    e[2][0] = 0.5131552598409154
    e[2][1] = 0.8759352295813813
    e[2][2] = 0.4127244146368775
    e[2][3] = 0.9190490419751117

    e[3][0] = 0.7445842897466164
    e[3][1] = 0.3305389644509955
    e[3][2] = 0.5937900429674227
    e[3][3] = 0.14275120308753864


    but the putput that i want it's like:


    e[0][0] = 0.5209047579028665
    e[0][1] = 0.16964228925556757
    e[0][3] = 0.4459449995595135

    e[1][1] = 0.1467566990111293
    e[1][2] = 0.6720265277818704
    e[1][3] = 0.9081362342452916

    e[2][0] = 0.5131552598409154
    e[2][2] = 0.4127244146368775
    e[2][3] = 0.9190490419751117

    e[3][0] = 0.7445842897466164
    e[3][1] = 0.3305389644509955
    e[3][2] = 0.14275120308753864
    It's mean i want to take a counter of row =3.
    Last edited by Tianma; 03-12-2012 at 11:39 AM.

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

    Default Re: Generate random number in evaluation score

    Quote Originally Posted by Tianma View Post
    Thanks for your all reply. if i understand true your sleps and waiheng1986 are the same right? but i think it's different with my case.
    Yes. Both those members appear to have not understood where your problem lies, and are trying to advise you about a different way to obtain a randim number. The second responder also appears to be trying to use this forum to promote its crappy blog, applying the logic that if the only tool you have is a hammer, treat everything as a nail.

    You don't need that. Your approach to generating random numbers is just fine.

    Quote Originally Posted by Tianma View Post
    It's mean i want to take a counter of row =3.
    Not clear. Nor is your original problem description adequately clear.

    For assigning three random reviewers out of a total of n reviewers to each of a total of m objects, I would create a Collection of n reviewers, iterate over a Collection of m objects, each time shuffling the reviewer collection and assigning the top three to the currently iterated object.

    Read about the Collections API in this tutorial Trail: Collections (The Java™ Tutorials)

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  9. #9
    Tianma is offline Member
    Join Date
    Mar 2012
    Posts
    5
    Rep Power
    0

    Default Re: Generate random number in evaluation score

    Quote Originally Posted by DarrylBurke View Post
    Yes. Both those members appear to have not understood where your problem lies, and are trying to advise you about a different way to obtain a randim number. The second responder also appears to be trying to use this forum to promote its crappy blog, applying the logic that if the only tool you have is a hammer, treat everything as a nail.

    You don't need that. Your approach to generating random numbers is just fine.


    Not clear. Nor is your original problem description adequately clear.

    For assigning three random reviewers out of a total of n reviewers to each of a total of m objects, I would create a Collection of n reviewers, iterate over a Collection of m objects, each time shuffling the reviewer collection and assigning the top three to the currently iterated object.

    Read about the Collections API in this tutorial Trail: Collections (The Java™ Tutorials)

    db
    Thanks so much sir. i'll try.

  10. #10
    Tianma is offline Member
    Join Date
    Mar 2012
    Posts
    5
    Rep Power
    0

    Default Re: Generate random number in evaluation score

    For assigning three random reviewers out of a total of n reviewers to each of a total of m objects, I would create a Collection of n reviewers, iterate over a Collection of m objects, each time shuffling the reviewer collection and assigning the top three to the currently iterated object.

    Read about the Collections API in this tutorial Trail: Collections (The Java™ Tutorials)

    db
    Hello, sir. When i read the collection, i'm confuse what i should do in my case, i should make a list,set or arraylist.Can you give me an example?

Similar Threads

  1. Generate Random Number Loop
    By saber210 in forum New To Java
    Replies: 9
    Last Post: 08-12-2011, 05:49 PM
  2. Replies: 3
    Last Post: 10-24-2010, 11:24 PM
  3. Trying to Generate Random number
    By PeterFeng in forum New To Java
    Replies: 10
    Last Post: 01-14-2009, 09:37 AM
  4. Generate a random number
    By romina in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 06:23 AM
  5. How to generate random number in java
    By fernando in forum New To Java
    Replies: 1
    Last Post: 08-01-2007, 08:32 PM

Tags for this Thread

Posting Permissions

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