Example usage for org.apache.commons.lang.math RandomUtils nextLong

List of usage examples for org.apache.commons.lang.math RandomUtils nextLong

Introduction

In this page you can find the example usage for org.apache.commons.lang.math RandomUtils nextLong.

Prototype

public static long nextLong(Random random) 

Source Link

Document

Returns the next pseudorandom, uniformly distributed long value from the given Random sequence.

Usage

From source file:org.encuestame.test.config.AbstractBase.java

/**
 * Create {@link SocialAccount}./*from  w ww  .  j  a va 2s . c  o  m*/
 * @param consumerKey
 * @param consumerSecret
 * @param secretToken
 * @param userAccount
 * @param socialProfileUsername
 * @return
 */
public SocialAccount createSocialAccount(final String token, final String secretToken,
        final UserAccount userAccount, final String socialProfileUsername, final Boolean verified,
        final SocialProvider provider) {
    final SocialAccount socialAccount = new SocialAccount();
    socialAccount.setAccessToken(token);
    socialAccount.setSecretToken(secretToken);
    socialAccount.setAccount(userAccount.getAccount());
    socialAccount.setUserOwner(userAccount);
    long randomNum = 100 + (int) (Math.random() * 4000);
    socialAccount.setSocialProfileId(String.valueOf(randomNum) + RandomStringUtils.randomAlphanumeric(10));
    socialAccount.setVerfied(verified);
    socialAccount.setUserOwner(userAccount);
    socialAccount.setAccounType(provider);
    socialAccount.setSocialAccountName(socialProfileUsername + RandomStringUtils.randomAlphanumeric(10));
    socialAccount.setUpgradedCredentials(new Date());
    socialAccount.setAddedAccount(new Date());
    socialAccount.setEmail("email" + String.valueOf(randomNum));
    socialAccount.setProfileUrl("url" + String.valueOf(randomNum));
    socialAccount.setRealName("real name" + String.valueOf(randomNum));
    socialAccount.setApplicationKey(RandomUtils.nextLong(new Random(50)));
    socialAccount.setRefreshToken("refresh_token_" + RandomStringUtils.randomAlphanumeric(10));
    socialAccount.setType(org.encuestame.utils.social.TypeAuth.OAUTH1);
    getAccountDao().saveOrUpdate(socialAccount);
    return socialAccount;
}

From source file:org.isisaddons.module.fakedata.dom.Longs.java

@Programmatic
public long any() {
    return RandomUtils.nextLong(fake.random);
}