All pastes #9951 Raw Edit

Miscellany

public java v1 · immutable
#9951 ·published 2005-04-20 22:45 UTC
rendered paste body
/**GOAL: to generate a Random # between -0.9 and +0.9I couldn't figure out how to do this with Math.random (only goes to 0.9)so tried using CLASS RandomEverything seemed okay when testing at first, but while working, all of a suddennow it will generate ONLY 150 negatives or only 150 Positives, and every value is within " a tenths" value(or two).Do not understand what am doing wrong that is making these not really Random as expected/was doing previously.*/import java.util.Random;public class QuickRandom{       public QuickRandom()    {        for (int i = 0; i <=150; i++){        Random generator = new Random();        double angle = generator.nextDouble() * 1.9 - 0.9;        System.out.println("this is angle: " + angle);      }    }        public static void main( String args[] )    {        QuickRandom qr = new QuickRandom();       }}