Changeset 4567 for trunk/utils


Ignore:
Timestamp:
10/27/08 18:36:13 (12 years ago)
Author:
curtis
Message:

Allow command line parameter to override default number of characters.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/utils/RandomPass.java

    r1216 r4567  
    1111 
    1212  public static void main(String[] args) { 
    13     StringBuffer sb = new StringBuffer(PASS_LEN + 2); 
     13    int passLen = PASS_LEN; 
     14    if (args.length > 0) { 
     15      passLen = Integer.parseInt(args[0]); 
     16    } 
     17    StringBuffer sb = new StringBuffer(passLen + 2); 
    1418    int range = MAX_CHAR - MIN_CHAR + 1; 
    15     for (int i=0; i<PASS_LEN; i++) { 
     19    for (int i=0; i<passLen; i++) { 
    1620      char c = (char) (range * Math.random() + MIN_CHAR); 
    1721      sb.append(c); 
Note: See TracChangeset for help on using the changeset viewer.