Skip to content

Commit

Permalink
补全注释
Browse files Browse the repository at this point in the history
  • Loading branch information
yindz committed Mar 9, 2020
1 parent 13219a9 commit ca9a285
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,13 @@ public long randomTimestamp(LocalDate date) {
return randomTimestamp(begin, end);
}

/**
* 随机时间戳
*
* @param base 基准时间
* @param maxSeconds 最大相差秒
* @return 随机时间戳
*/
private long randomTimestamp(LocalDateTime base, long maxSeconds) {
Preconditions.checkArgument(base != null, "基准时间不能为空");
Preconditions.checkArgument(Math.abs(maxSeconds) > 1, "相差秒数必须大于1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,12 @@ public String randomMacAddress(String splitter) {
int n = RandomUtils.nextInt(0, 255);
mac.add(String.format("%02x", n));
}
return Joiner.on(splitter).join(mac).toUpperCase();
return Joiner.on(StringUtils.isNotEmpty(splitter) ? splitter : "-").join(mac).toUpperCase();
}

/**
* 随机端口号
* 注意: 不会生成1024及以下的端口号
*
* @return 随机端口号
*/
Expand Down

0 comments on commit ca9a285

Please sign in to comment.