1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

Merge pull request #74 from andrewgaul/generateboundary-random

Use Random.nextInt instead of Math.random.
This commit is contained in:
Andrew Chen 2011-10-26 18:03:57 -07:00
commit d9e6426e33

View File

@ -6,6 +6,7 @@ import com.fsck.k9.mail.MessagingException;
import com.fsck.k9.mail.Multipart;
import java.io.*;
import java.util.Random;
public class MimeMultipart extends Multipart {
protected String mPreamble;
@ -37,10 +38,11 @@ public class MimeMultipart extends Multipart {
}
public String generateBoundary() {
Random random = new Random();
StringBuilder sb = new StringBuilder();
sb.append("----");
for (int i = 0; i < 30; i++) {
sb.append(Integer.toString((int)(Math.random() * 35), 36));
sb.append(Integer.toString(random.nextInt(36), 36));
}
return sb.toString().toUpperCase();
}