本文整理匯總了Java中org.apache.commons.lang3.RandomUtils.nextLong方法的典型用法代碼示例。如果您正苦於以下問題:Java RandomUtils.nextLong方法的具體用法?Java RandomUtils.nextLong怎麽用?Java RandomUtils.nextLong使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.lang3.RandomUtils
的用法示例。
在下文中一共展示了RandomUtils.nextLong方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testInsert
import org.apache.commons.lang3.RandomUtils; //導入方法依賴的package包/類
@Test
public void testInsert() {
for (int i = 0; i < mobiles.length; i++) {
if (StringUtils.isBlank(mobiles[i])) {
mobiles[i] = "13800" + RandomUtils.nextLong(100000, 999999);
}
UserEntity entity = new UserEntity();
entity.setCreatedAt(new Date());
entity.setEmail(mobiles[i] + "@163.com");
entity.setMobile(mobiles[i]);
entity.setType((short) (i % 2 == 0 ? 1 : 2));
entity.setStatus((short) (i % 3 == 0 ? 1 : 2));
mapper.insert(entity);
}
}
示例2: itShouldHaveAnElegantConstructionMechanism
import org.apache.commons.lang3.RandomUtils; //導入方法依賴的package包/類
@Test
public void itShouldHaveAnElegantConstructionMechanism() {
long commandTimeoutInSeconds = RandomUtils.nextLong();
CryptotoolOptions cryptotoolOptions = CryptotoolOptionsImpl.builder()
.binaryExecutor(BinaryExecutorImpl.createDefault())
.commandTimeout(Duration.ofSeconds(commandTimeoutInSeconds))
.build();
assertThat(cryptotoolOptions, is(notNullValue()));
assertThat(cryptotoolOptions.getBinaryExecutor(), is(notNullValue()));
assertThat(cryptotoolOptions.getCommandTimeout(), is(Duration.ofSeconds(commandTimeoutInSeconds)));
}
開發者ID:amvnetworks,項目名稱:amv-highmobility-cryptotool-wrapper,代碼行數:13,代碼來源:CryptotoolOptionsImplTest.java
示例3: getExpire
import org.apache.commons.lang3.RandomUtils; //導入方法依賴的package包/類
public long getExpire() {
long rnd = RandomUtils.nextLong(0, expire / 3);
return expire + (rnd > IN_1HOUR ? IN_1HOUR : rnd);
}
示例4: generate
import org.apache.commons.lang3.RandomUtils; //導入方法依賴的package包/類
@Override
public Object generate(DefaultContext ctx) throws Exception {
return new Date(RandomUtils.nextLong() % System.currentTimeMillis());
}
示例5: randomNumber
import org.apache.commons.lang3.RandomUtils; //導入方法依賴的package包/類
public long randomNumber() {
return RandomUtils.nextLong(startRange.get(), endRange.get());
}
示例6: getDefaultExpireSeconds
import org.apache.commons.lang3.RandomUtils; //導入方法依賴的package包/類
/**
* 默認過期時間
* @return
*/
public static long getDefaultExpireSeconds() {
return CacheExpires.IN_1WEEK + RandomUtils.nextLong(1, CacheExpires.IN_1DAY);
}