944,196 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 4061
  • Java RSS
Feb 11th, 2007
0

Random number generator

Expand Post »
Hi, I am working on a personal program, not homework trust me, and the main engine driving it is a random number generator. Unfortunately, I don't know how to build that engine! To make a long story short, I have objects that have a ranking, from 1 to 10, that I want to make appear randomly in a list. Every rank starts at zero, and the rankings increase by people voting on them. The votes are from 1 to 10, 1 being the lowest and 10 the highest, and the rank is rank #/total # of votes. The problem is, I don't want the objects with the higher ranks to end up being the only ones that are randomly chosen, but I still want the rank to have some kind of effect on the probability the 10's come up. Any info, or links to code that is not the Math.Random method in Java would be appreciated
Similar Threads
Reputation Points: 19
Solved Threads: 4
Light Poster
MacGyver Orca is offline Offline
39 posts
since Jan 2007
Feb 11th, 2007
0

Re: Random number generator

try something like a search engine.
Or a book on probability theory.
And why don't you want to use the built-in random number generator? That very fact tells me that it IS in fact homework, as every realistic project first tries to find an existing component to do something like that as it saves a lot of time and effort and is far more likely to work correctly than something you write yourself.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Feb 11th, 2007
0

Re: Random number generator

I can't emphasize enough that this is not homework, if you read the last part of my first post I try to explain that I want the rank to have some effect on the 'random' choosing of the objects, but not an overriding positive/negative effect on the frequency. If I thought the Math.random method could do this, I would use it, but I don't think it will work, but if anyone has a way to use the Math.random in conjunction with what I want to do, then please feel free to tell me.
Reputation Points: 19
Solved Threads: 4
Light Poster
MacGyver Orca is offline Offline
39 posts
since Jan 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: java program to calculate simple interest
Next Thread in Java Forum Timeline: Sound Camparison.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC