private static String generateEvent ( Long currTime , int delayInMillis ) { TeamInfo team = randomTeam ( liveTeams ) ; String teamName = team . getTeamName ( ) ; String user ; final int parseErrorRate = 900000 ; String robot = team . getRobot ( ) ; // If the team has an associated robot team member... if ( robot != null ) { // Then use that robot for the message with some probability. // Set this probability to higher than that used to select any of the 'regular' team // members, so that if there is a robot on the team, it has a higher click rate. if ( random . nextInt ( team . numMembers ( ) / 2 ) == 0 ) { user = robot ; } else { user = team . getRandomUser ( ) ; } } else { // No robot. user = team . getRandomUser ( ) ; } String event = user + "," + teamName + "," + random . nextInt ( MAX_SCORE ) ; // Randomly introduce occasional parse errors. if ( random . nextInt ( parseErrorRate ) == 0 ) { System . out . println ( "Introducing a parse error." ) ; event = "THIS LINE REPRESENTS CORRUPT DATA AND WILL CAUSE A PARSE ERROR" ; } return addTimeInfoToEvent ( event , currTime , delayInMillis ) ; }
Generate a user gaming event .