mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Prefer Random.nextInt over Math.random
Addresses a FindBugs complaint.
This commit is contained in:
parent
47a4bd77ad
commit
e394924ce4
@ -6,6 +6,7 @@ import com.fsck.k9.mail.MessagingException;
|
|||||||
import com.fsck.k9.mail.Multipart;
|
import com.fsck.k9.mail.Multipart;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class MimeMultipart extends Multipart {
|
public class MimeMultipart extends Multipart {
|
||||||
protected String mPreamble;
|
protected String mPreamble;
|
||||||
@ -37,10 +38,11 @@ public class MimeMultipart extends Multipart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String generateBoundary() {
|
public String generateBoundary() {
|
||||||
|
Random random = new Random();
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("----");
|
sb.append("----");
|
||||||
for (int i = 0; i < 30; i++) {
|
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();
|
return sb.toString().toUpperCase();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user