Java
Java
Generating Random Integer in Range
See more PRNG Examples
Demonstrates how to generate random integers in a specified range.Chilkat Java Downloads
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
boolean success = false;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
success = false;
CkPrng fortuna = new CkPrng();
// Generate random integers between 12 and 24 inclusive
int i;
for (i = 0; i <= 100; i++) {
System.out.println(fortuna.RandomInt(12,24));
}
}
}