Skip to content

Instantly share code, notes, and snippets.

@imjoey
Created June 10, 2015 06:36
Show Gist options
  • Save imjoey/421c18bcb06a27bac1a8 to your computer and use it in GitHub Desktop.
Save imjoey/421c18bcb06a27bac1a8 to your computer and use it in GitHub Desktop.
Java random functions
package com.newcoresys.utils;
/**
* 随即数生成器
* @author huminjie
*
*/
public class RandomUtil {
/**
* @param number 几位数
* @return 返回字符串
*/
public static String Random(int number) {
StringBuffer random = new StringBuffer();
for (int i = 0; i < number; i++) {
random.append((int) (Math.random() * 10));
}
return random.toString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment