This commit is contained in:
Looly
2022-08-06 18:51:28 +08:00
parent 0b14f237f7
commit 5a91443e36
2 changed files with 4 additions and 3 deletions

View File

@@ -549,11 +549,11 @@ public class RandomUtil {
if (StrUtil.isEmpty(baseString)) {
return StrUtil.EMPTY;
}
final StringBuilder sb = new StringBuilder(length);
if (length < 1) {
length = 1;
}
final StringBuilder sb = new StringBuilder(length);
int baseLength = baseString.length();
for (int i = 0; i < length; i++) {
int number = randomInt(baseLength);