Java tutorial
//package com.java2s; //License from project: Apache License public class Main { public static int getTextPosition(int height) { int tempPosition = (int) (Math.random() * height); if (tempPosition < 0.5 * height) { tempPosition += 0.5 * height; } return tempPosition; } }