Hey guys. I'm working in some exercises and one of them tells me I need to program a code where I generate a die where I get values between 1 and 6.
This is what I have:
import java.util.Random; public class RandomGenerator { public static void main(String[] args) { Random generator = new Random(); System.out.println(generator.nextInt(7)); //How can I eliminate 0 from the answers? } }
It works out well except that I want to eliminate 0 from the answers and don't know how. Could anyone help?