Computer Science, asked by Anonymous, 5 months ago

Write a program to stimulate 4 rolls of a single die to generate an integer value from 1 to 6.

Answers

Answered by Itzraisingstar
9

\bold{Answer:}

public class Random

{

  void generate()

   

  {

       int min=1,max=6,value;

       int range=max-min+1;

       //Roll 1

       value =(int)((Math.random()*range)+min);

       system.out.println("Roll 1:"+value);

       //Roll 2

       value=(int)((Math.random()*range)+min);

       System.out.println("Roll2:"+value);

       //Roll 3

       value-(int)((Math.random()*range)+min);

       System.out.println("Roll3:"+value);

        //Roll 4

       value=(int)((Math.random()*range)+min);

       System.out.println("Roll4:"+value);

  }

}          

Similar questions