package ch.deletescape.primitives;

public class Int {
  /**
   * Private Constructor to prevent initialization
   */
  private Int() {
  }

  /**
   * Converts a long value to integer by simply casting it
   * 
   * @param lng
   *          the long value to convert
   * @return the resulting integer.
   */
  public static int from(long lng) {
    return (int) lng;
  }

  /**
   * Converts a double value to integer by simply casting it
   * 
   * @param dbl
   *          the double value to convert
   * @return the resulting integer.
   */
  public static int from(double dbl) {
    return (int) dbl;
  }

  /**
   * Converts a float value to integer by simply casting it
   * 
   * @param flt
   *          the float value to convert
   * @return the resulting integer.
   */
  public static int from(float flt) {
    return (int) flt;
  }

  /**
   * Converts a boolean value to integer, {@code true} resulting in {@code 1} and {@code false}
   * resulting in {@code 0}
   * 
   * @param bool
   *          the boolean value to convert
   * @return the resulting integer.
   */
  public static int from(boolean bool) {
    return bool ? 1 : 0;
  }
}

@@ -33,26 +33,85 @@
 s;%0A%0A
-public class Int %7B
+import java.util.Random;%0A%0Apublic class Int %7B%0A  private static Random random;%0A
 %0A  /
@@ -1208,11 +1208,352 @@
 : 0;%0A  %7D
+%0A%0A  /**%0A   * Convenience method for %7B@link Random#nextInt()%7D, the first time this method is called a new%0A   * %7B@link Random%7D instance is created%0A   * %0A   * @return a pseudorandom integer value.%0A   * @see Random%0A   */%0A  public static int random() %7B%0A    if (random == null) %7B%0A      random = new Random();%0A    %7D%0A    return random.nextInt();%0A  %7D
 %0A%7D%0A

Implement a convenience method to generate random integers