s_cheplick12 wrote:Sorry but id does work. Starting with an initial value of 10, a sample set of values I get are
This does not work:
flounder wrote:It only adds subtracts .5 in every trial. It never adds .5... Hmmmmm, back to the drawing board
In that case I would go with sabre's second suggestion.
value += myRandom.nextInt(2) - 0.5;
gimbal2 wrote:Edited by: DarrylBurke
Learning the language is not rocket science you know; using the language to create working applications is. Since your goal right now is learning the language, it is probably easier than you are making yourself believe. All it requires is to start simple and have a goal application in mind that you want to make and a good resource to learn from, such as the java tutorial.
Save yourself the money man, you are only going to attract somebody that knows less than you do and will thus teach you everything you DON"T want to know or do. If you ever have a specific problem with one of your assignments, feel free to ask for help here. Just make sure you put some effort into the problem yourself first, don't expect people to write the code for you.
That method could be reused throughout the class and might add to your codes readability. You could even influence the wheigt (is that the word?) of the two possibilities by changing someFloatBetweenZeroAndOne.
myRandom.nextFloat()> someFloatBetweenZeroAndOne? .5; -.5;