Selathco 0.91 generated HTML
Predchozi Table of contents ) Dalsi

5. Other Important Features

In this relatively short chapter, some auxiliary functions, provided by J-Sim in addition to its standard services, will be shortly described. These services are offered by the JSimSystem class as its static methods, thus there is no need to make any instances of this class. All the methods mentioned below can be invoked like this: JSimSystem.method(parameters).

5.1. Generators of Random Numbers

In J-Sim, following random-numbers generators are available:

  • generator of random numbers having exponential distribution;

  • generator of random numbers having uniform distribution;

  • generator of random numbers having normal (Gaussian) distribution;

  • generator of random boolean values.

The exponential-distribution random numbers are generated by a method called negExp(). It takes one argument lambda which is the theoretical parameter lambda of the generator. The method's header:


public static double negExp(double lambda)

The uniform-distribution random numbers are generated by a method called uniform(). It takes two arguments a and b, representing boundaries of the interval <a,b>, from which the random numbers are taken. The method's header:

public static double uniform(double a, double b)

The normal-distribution random numbers are generated by method gauss() which takes two arguments mu and sigma. These arguments represent the theoretical mean value mu and the theoretical variance sigma. The method's header:

public static double gauss(double mu, double sigma)

The draw() method returns random boolean values accordingly to the probability p given as parameter; true is returned with probability p, false with probability 1-p. The value of the argument should be within the interval <0,1>. If it is less than 0, false if always returned. If it is greater than 1, true is always returned. The method's header:

public static boolean draw(double probability)

5.2. Version Functions

Every J-Sim version has its major, minor and patch version number. They can be obtained using the following methods:

  • public static int getVersionMajor()

  • public static int getVersionMinor()

  • public static int getVersionPatch()

To obtain complete J-Sim version, including the information about language and country, the getVersion() method can be used. It returns a string containing all available information, e.g. "J-Sim version 0.1.1 en_US".


Predchozi
Converted by Selathco 0.91 on 01.09.2001 18:44
Dalsi