get Random Sign - Android java.util

Android examples for java.util:Random

Description

get Random Sign

Demo Code


//package com.java2s;

public class Main {
    public static int getRandSign() {
        return (int) Math.pow(-1, (int) (Math.random() / 0.5));
    }/*from ww  w  .j av  a 2 s .c o  m*/
}

Related Tutorials