Java代码实现抖音超级福袋抢购模拟
import java.util.Random;
public class DouyinSuperLuckyBag { public static void main(String[] args) { boolean isLucky = grabSuperLuckyBag(); if (isLucky) { System.out.println('恭喜你抢到了抖音超级福袋!'); } else { System.out.println('很遗憾,你没有抢到抖音超级福袋。'); } }
public static boolean grabSuperLuckyBag() {
Random random = new Random();
int luckyNumber = random.nextInt(1000);
if (luckyNumber % 2 == 0) {
return true;
} else {
return false;
}
}
}
原文地址: https://www.cveoy.top/t/topic/lNfY 著作权归作者所有。请勿转载和采集!