| | |
Random number generator
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
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
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.
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.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
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.
![]() |
Similar Threads
- Random number generator's (C++)
- Realy weird random number generator bug (C++)
- Random number generator (Java)
- Random number generator (Java)
- random number generator (C++)
- Help with random number gen (C++)
Other Threads in the Java Forum
- Previous Thread: java program to calculate simple interest
- Next Thread: Sound Camparison.
Views: 3255 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for Java
add android api apple applet application arguments array arrays automation bank binary bluetooth chat chooser class classes client code component converter database digit draw eclipse equation error event exception file fractal functiontesting game givemetehcodez graphics gui health helpwithhomework html hyper ide idea image infinite input int integer j2me java javame javaprojects jmf jni jpanel julia linux list loop main map method methods mobile myregfun netbeans newbie nonstatic number object oracle pattern pearl print problem program programming project recursion scanner screen scrollbar server set size sms socket sort spamblocker sql sqlserver string superclass swing test thread threads time transfer tree windows






