private Person getRandomPerson ( ) { Person person = new Person ( ) ; person . setId ( getNextId ( ) ) ; String firstname = FIRSTNAMES [ random . nextInt ( FIRSTNAMES . length ) ] ; String surname = SURNAMES [ random . nextInt ( SURNAMES . length ) ] ; person . setName ( firstname + " " + surname ) ; String housenum = ( random . nextInt ( 99 ) + 1 ) + " " ; String road1 = ROADS1 [ random . nextInt ( ROADS1 . length ) ] ; String road2 = ROADS2 [ random . nextInt ( ROADS2 . length ) ] ; String town = TOWNS [ random . nextInt ( TOWNS . length ) ] ; String address = housenum + road1 + " " + road2 + ", " + town ; person . setAddress ( address ) ; float salary = Math . round ( 10 + 90 * random . nextFloat ( ) ) * 1000 ; person . setSalary ( salary ) ; return person ; }
Create a random person