Processing.js - Is there something wrong with this code?
in
Processing with Other Languages
•
1 year ago
NOTE: Sorry for the non-descriptive title, but I lack much information other than that about the problem...
I'm just getting started with Processing.js, and I'm trying to create some test programs.
The one below tests the randomness of the random function... which works fine in Standard mode, but won't start in JavaScript mode.
I'm curious as to which part of the code is causing this... or am I doing something wrong altogether?
I've gotten other programs working, so it isn't a problem with my setup...
The code:
I'm thinking that it might be the use of Integer?
Also, this is just test code... it certainly isn't fully optimized...
I'm just getting started with Processing.js, and I'm trying to create some test programs.
The one below tests the randomness of the random function... which works fine in Standard mode, but won't start in JavaScript mode.
I'm curious as to which part of the code is causing this... or am I doing something wrong altogether?
I've gotten other programs working, so it isn't a problem with my setup...
The code:
- ArrayList<Integer> list;
- void setup() {
- size(600, 400);
- list = new ArrayList<Integer>();
- fill(0);
- noStroke();
- }
- void draw() {
- background(255);
- list.add(new Integer((int) random(0, 100)));
- int[] count = new int[100];
- for(int i = 0; i < list.size(); i ++) {
- count[list.get(i)] ++;
- }
- for(int i = 0; i < count.length; i ++) {
- rect(i * 6, height, 6, -count[i] * 6);
- }
- }
I'm thinking that it might be the use of Integer?
Also, this is just test code... it certainly isn't fully optimized...
1