#!/usr/bin/python
import random, string
myrg = random.SystemRandom()
length = 10
# If you want non-English characters, remove the [0:52]
alphabet = string.letters[0:52] + string.digits
pw = str().join(myrg.choice(alphabet) for _ in range(length))
print pw
Java password generator resource:
import java.security.SecureRandom;
import com.Ostermiller.util.RandPass;
public class PasswordGenerater {
public static void main(String[] args) {
RandPass rp = new RandPass(sr);
System.out.println(rp.getPass());
}
}