Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CopyOfRobotWalk {
- public static void main(String[] args) {
- number();
- }
- public static void number() {
- int average = 0;
- for (int i = 1; i <= 20; i++) {
- double d = (Math.random()*4)-1;
- int num = (int)(d*20);
- average = num;
- System.out.println("On simulation " + i + " the robot went " + num + " steps in 20 tries.");
- }
- System.out.print(average);
- }
- }
Add Comment
Please, Sign In to add comment