Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Apex Get Random Value
public with sharing class CommonUtil {
* ランダム値取得
public static Integer getRandomNumber(Integer upperLimit) {
if (upperLimit == null || upperLimit <= 0) {
return 0;
Integer rand = Math.round(Math.random()*1000);
return Math.mod(rand, upperLimit);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.