added random method for generating coordinates.