We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I was trying to use the function nextGaussian() in class Random and this problem came up.
Then, I tried to add "import java.util.Random;"; it says "The import java.util.Random conflicts with a type defined in the same file."
Finally I used "final Random generator = new Random();" instead; it doesn't seem help at all.
My processing version is 3.2.1
The code shows as below:
Random generator;
void setup(){
size(640,360);
generator = new Random();
}
void draw(){
float x = (float) generator.nextGaussian();
}
Answers
Is your sketch named Random? If it is change it to something else.
Using the final keyword will have absolutely no effect in this situation.
you can always use the fully qualified class name to avoid this
drop the import