how can i randomize the number
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Sets up the SortGrid world. This includes creating all nodes * and numbers, connecting the nodes up and placing them in the world. * * @author Joseph Lenton */ public class SortGrid extends World { private static final int WIDTH = 400; private static final int HEIGHT = 600; private static final int NUMBER_Y = 50; private static final int NUMBER_PADDING = 100; private static final int NUMBER_X = 150; private static final int NUM_POSITIONS = 2; /** * Creates and sets up the SortGrid world ready to be run. */ public SortGrid() { super( WIDTH, HEIGHT, 1 ); // create the network node Node first = new Node();final int leftX = WIDTH/2; addObject( first , leftX, 300 ); // end nodes End[] ends = new End[ NUM_POSITIONS ]; for ( int i = 0; i < ends.length; i++ ) { End end = new End(); ends[i] = end; addObject( end, NUMBER_X + NUMBER_PADDING*i, HEIGHT-NUMBER_Y ); } // create the connections first.setDestinations( ends[0], ends[1] ); final int[] randomNums = {1, 2}; final Number[] numbers = new Number[ NUM_POSITIONS ]; // make the numbers for ( int i = 0; i < NUM_POSITIONS; i++ ) { final Number number = new Number( randomNums[i] ); final int x = NUMBER_X + NUMBER_PADDING*i; final int y = NUMBER_Y; numbers[i] = number; addObject( number, x, y ); addObject( new Start(), x, y ); } // set the number destinations numbers[0].setDestination( first ); numbers[1].setDestination( first ); // paint ordering setPaintOrder( Number.class, Node.class, Position.class, Start.class ); } }