Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Random;

public class Main {
    public static void main(String[] args) {
        for (int i = 0; i < 100; i++) {
            System.out.println(randomOneOrMinusOne());
        }
    }

    static int randomOneOrMinusOne() {
        Random rand = new Random();
        if (rand.nextBoolean())
            return 1;
        else
            return -1;
    }
}