Skip to content

Instantly share code, notes, and snippets.

@hhhaiai
Created July 30, 2020 07:55
Show Gist options
  • Save hhhaiai/c2b5d35e2de6a74dd2ca6a37917097fa to your computer and use it in GitHub Desktop.
Save hhhaiai/c2b5d35e2de6a74dd2ca6a37917097fa to your computer and use it in GitHub Desktop.
public static String randomAndroidID() {
String str[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F" };
StringBuilder sb = new StringBuilder();
Random random = new Random(System.nanoTime());
for (int i = 0; i < 16; i++) {
int iRand = random.nextInt(str.length);
String charmac = str[iRand];
sb.append(charmac);
}
return sb.toString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment