1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Prefer Random.nextInt over Math.random

Addresses a FindBugs complaint.
This commit is contained in:
Andrew Gaul 2011-10-25 21:21:23 -07:00
parent 47a4bd77ad
commit e394924ce4

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();
}