/** * Sets tweet position randomly within radius * * @param tweet the tweet data */ private void randomPlaceWithinRadius(Tweet tweet) { double radius = config.getRadius(); double maxDegreeDiff = radius / SURFACE_DISTANCE; double latR = random.nextDouble(); double lonR = random.nextDouble(); latR = (latR - 0.5) * 2; // -1 to 1 lonR = (lonR - 0.5) * 2; // -1 to 1 GeoCoordinate sc = config.getPosition(); GeoCoordinate gc = new GeoCoordinate( sc.getLatitude() + latR * maxDegreeDiff, sc.getLongitude() + lonR * maxDegreeDiff, 0); tweet.setUserCoordinate(gc); }