Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package mysql_datagen;
- /**
- *
- * @author ASROYA
- */
- public class MySQL_DataGen {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- double battingAvg = 0.000; //between 0 and 1 (decimals)
- Integer rbi = 0; //between 0 and 190
- double era = 0.00; //between 0 and 10 (decimals)
- Integer wins = 0; //between 1 and 120
- Integer homeruns = 0; //between 1 and 75
- Integer player_id = 0; //between 1 and 400
- Integer season_id = 0; //between 1 and 15
- for (int id = 1001; id <= 1010; id++){
- battingAvg = (double) (Math.random() * 0.999 + 0.000);
- rbi = (int) (Math.random() * 190 + 0);
- era = (double) (Math.random() * 10.00 + 0.00);
- wins = (int) (Math.random() * 120 + 1);
- homeruns = (int) (Math.random() * 75 + 1);
- player_id = (int)(Math.random() * 400 + 1);
- season_id = (int) (Math.random() * 15 + 1);
- System.out.print("insert into stat (stat_id, batting_average, rbi, era, wins, homeruns, player_id, season_id) ");
- System.out.println("values (" + id +", " + battingAvg + ", " + rbi + ", " + era + ", " + wins + ", " + homeruns + ", " + player_id + ", " + season_id + ");");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement