@@ -216,29 +216,23 @@ public int getBirthMonth(long birthDay) {
216
216
//User's age for graduating is from 20 to 30
217
217
218
218
public long getClassYear (Random random , long userCreatedDate , long birthday ) {
219
- long age ;
220
- long graduateage = (random .nextInt (5 ) + 20 ) * ONE_YEAR ;
221
- if (birthday != -1 ) {
222
- return (long ) (birthday + graduateage );
223
- } else {
224
- age = (long ) (random .nextDouble () * THIRTY_YEARS + TEN_YEARS );
225
- return (userCreatedDate - age + graduateage );
226
- }
227
- }
228
-
229
- public long getWorkFromYear (Random random , long userCreatedDate , long birthday ) {
230
- long age ;
231
- long workingage = (random .nextInt (10 ) + 25 ) * ONE_YEAR ;
232
- if (birthday != -1 ) {
233
- return (long ) (birthday + workingage );
234
- } else {
235
- age = (long ) (random .nextDouble () * THIRTY_YEARS + TEN_YEARS );
236
- return (userCreatedDate - age + workingage );
237
- }
238
- }
239
-
240
- public long getWorkFromYear (Random random , long classYear ) {
241
- return (classYear + (long ) (random .nextDouble () * TWO_YEARS ));
219
+ long graduateage = (random .nextInt (5 ) + 18 ) * ONE_YEAR ;
220
+ long classYear = birthday + graduateage ;
221
+ if ( classYear > this .to_ ) return -1 ;
222
+ return classYear ;
223
+ }
224
+
225
+ public long getWorkFromYear (Random random , long classYear , long birthday ) {
226
+ long workYear = 0 ;
227
+ if ( classYear == -1 ) {
228
+ //long workingage = (random.nextInt(10) + 25) * ONE_YEAR;
229
+ long workingage = 18 * ONE_YEAR ;
230
+ long from = birthday + workingage ;
231
+ workYear = Math .min ((long )(random .nextDouble ()*(to_ - from )) + from , to_ );
232
+ } else {
233
+ workYear = (classYear + (long ) (random .nextDouble () * TWO_YEARS ));
234
+ }
235
+ return workYear ;
242
236
}
243
237
244
238
public long getStartDateTime () {
0 commit comments