Created
June 10, 2015 06:36
-
-
Save imjoey/421c18bcb06a27bac1a8 to your computer and use it in GitHub Desktop.
Java random functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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