List of usage examples for org.apache.commons.lang RandomStringUtils randomNumeric
public static String randomNumeric(int count)
Creates a random string whose length is the number of characters specified.
Characters will be chosen from the set of numeric characters.
From source file:RandomStringUtilsTrial.java
public static void main(String[] args) { // Begin Lottery code System.out.print("6) The two digit lucky number for the day is >>>"); System.out.println(RandomStringUtils.randomNumeric(2)); // End Lottery code }
From source file:com.base.httpclient.HttpJsonClient.java
public static void main(String[] args) throws ClientProtocolException, IOException, URISyntaxException { String rdStr = RandomStringUtils.randomNumeric(9); log.info(rdStr);/*from w w w . java 2 s . c om*/ EqualsBuilder eb = new EqualsBuilder(); String url = "http://detailskip.taobao.com/json/ifq.htm?id=18278375481&sid=" + rdStr + "&q=1"; String jsonStr = HttpJsonClient.get(url, null); String str = StringUtilsExtends.substringBetween(jsonStr, ":{", "}"); Map<String, Integer> map = JsonUtil.getMap4Json("{" + str + "}"); log.info(map.get("quanity") + ""); }
From source file:com.lzhao.framework.spring_hibernate.demo.util.RandomUtil.java
public static String randomPostcode() { return RandomStringUtils.randomNumeric(4); }
From source file:com.neusoft.mid.clwapi.tools.RandomNumberUtil.java
/** * ?18?long?(long?9223372036854775807,19?) * /* w ww. ja v a 2 s. co m*/ * @param digit * ??? */ public static long randomLong(final int digit) { if (digit >= 19 || digit <= 0) { throw new IllegalArgumentException("digit should between 1 and 18(1<=digit<=18)"); } final String s = RandomStringUtils.randomNumeric(digit - 1); return Long.parseLong(getPrefix() + s); }
From source file:com.neusoft.mid.clwapi.tools.RandomNumberUtil.java
public static String randomString(final int digit) { if (digit >= 19 || digit <= 0) { throw new IllegalArgumentException("digit should between 1 and 18(1<=digit<=18)"); }//ww w . j a v a 2 s . co m return getPrefix() + RandomStringUtils.randomNumeric(digit - 1); }
From source file:com.boyuanitsm.fort.service.util.RandomUtil.java
/** * Generates an activation key./* ww w . j a v a 2s .co m*/ * * @return the generated activation key */ public static String generateActivationKey() { return RandomStringUtils.randomNumeric(DEF_COUNT); }
From source file:com.boyuanitsm.fort.service.util.RandomUtil.java
/** * Generates a reset key./*from ww w.java 2 s. c om*/ * * @return the generated reset key */ public static String generateResetKey() { return RandomStringUtils.randomNumeric(DEF_COUNT); }
From source file:com.ewcms.publication.uri.UriRules.java
/** * ???/*from w w w.j av a 2s. co m*/ * * @param rule uri * @param context ? * @return */ private static UriRuleable initResourceParameters(UriRuleable rule, String context) { rule.putParameter("context", context); rule.putParameter("n", RandomStringUtils.randomNumeric(32)); return rule; }
From source file:edu.sampleu.admin.CampusAftBase.java
protected void createNewEnterDetails() throws InterruptedException { waitAndTypeByName("document.documentHeader.documentDescription", RandomStringUtils.randomAlphabetic(30)); String randomAlphabetic = RandomStringUtils.randomAlphabetic(10); String randomNumbeForCode = RandomStringUtils.randomNumeric(1); String randomAlphabeticForCode = RandomStringUtils.randomAlphabetic(1); clearTextByName("document.newMaintainableObject.code"); waitAndTypeByName("document.newMaintainableObject.code", randomNumbeForCode + randomAlphabeticForCode); waitAndTypeByName("document.newMaintainableObject.name", randomAlphabetic); waitAndTypeByName("document.newMaintainableObject.shortName", randomAlphabetic); selectByName("document.newMaintainableObject.campusTypeCode", "B - BOTH"); }
From source file:fr.itldev.koya.repo.security.authentication.EmailBasedNameGenerator.java
@Override public String generateUserName(String firstName, String lastName, String emailAddress, int seed) { String userName = emailAddress.toLowerCase().trim().replaceAll("[^a-z1-9]", "_"); if (seed > 0) { userName = userName + RandomStringUtils.randomNumeric(3); }// ww w .j a v a2 s .c o m return userName; }