package ca.krasnay.sqlbuilder;

public class UniqueStringGenerator implements Supplier<String> {

    @Override
    public String get() {
        // TODO Auto-generated method stub
        return null;
    }

}

@@ -29,156 +29,1790 @@
 r;%0A%0A
-public class UniqueStringGenerator implements Supplier%3CString%3E %7B%0A%0A    @Override%0A    public String get() %7B%0A        // TODO Auto-generated method stub
+import java.security.SecureRandom;%0A%0A/**%0A * Generator of unique strings, suitable to use as unique IDs. The resulting%0A * strings are Base62-encoded, using the digits 0-9 and the letters a-z and A-Z.%0A *%0A * %3Cp%3EYou should choose a string length that is reasonably unlikely to collide%0A * with an existing value; however, note that longer strings bloat the size%0A * of database indexes, possibly slowing your data access. You can estimate%0A * your chance of collision using the %3Ca href=%22http://en.wikipedia.org/wiki/Birthday_problem%22%3EBirthday Problem%3C/a%3E.%0A * The chance of collision is approximately %3Ccode%3En%5E2 / (2 * 62%5Ec)%3C/code%3E, where %3Ccode%3En%3C/code%3E%0A * is the number of rows and %3Ccode%3Ec%3C/code%3E is the length of the string. Using%0A * this calculation, we see that with a 12 character string and a billion samples%0A * there is only about a 0.015%25 chance of collision, while with an 8 character string%0A * and 100,000 samples there is about a 0.002%25 chance of collision. Note however%0A * that the chance of collision increases with the square of the number of samples,%0A * so an 8 character string with a million samples increases the odds of%0A * collision to 0.2%25.%0A *%0A * @author %3Ca href=%22mailto:john@krasnay.ca%22%3EJohn Krasnay%3C/a%3E%0A */%0Apublic class UniqueStringGenerator implements Supplier%3CString%3E %7B%0A%0A    private static final String BASE62 = %220123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz%22;%0A%0A    private int length;%0A%0A    public UniqueStringGenerator(int length) %7B%0A        this.length = length;%0A    %7D%0A%0A    @Override%0A    public String get() %7B%0A        SecureRandom random = new SecureRandom();%0A        StringBuilder sb = new StringBuilder();%0A        int n = BASE62.length();%0A        for (int i = 0; i %3C length; i++) %7B%0A            sb.append(BASE62.charAt(random.nextInt(n)));%0A        %7D
 %0A   
@@ -1827,12 +1827,21 @@
 urn 
-null
+sb.toString()
 ;%0A  

Implement UniqueStringGenerator