public static double fromSAX(int levels,int sax,boolean random){
  SAX(levels,0.0D);
  double[] bounds=INVNORM_BOUNDS[levels - 1];
  if (sax < 0 || sax > bounds.length) {
    throw new RuntimeException("Invalid quantification symbol.");
  }
  if (sax > 0 && sax < bounds.length) {
    if (!random) {
      return 0.5D * (bounds[sax] + bounds[sax - 1]);
    }
 else {
      double x=Math.random();
      return x * bounds[sax - 1] + (1.0D - x) * bounds[sax];
    }
  }
  if (0 == sax) {
    if (!random) {
      return bounds[0] - 2.0D * (bounds[1] - bounds[0]);
    }
 else {
      return bounds[0] - Math.exp(1.0D / Math.random());
    }
  }
 else {
    if (!random) {
      return bounds[bounds.length - 1] + 2.0D * (bounds[bounds.length - 1] - bounds[bounds.length - 2]);
    }
 else {
      return bounds[bounds.length - 1] + Math.exp(1.0D / Math.random());
    }
  }
}

public static double fromSAX ( int levels , int sax , boolean random ) { SAX ( levels , 0.0D ) ; double [ ] bounds = INVNORM_BOUNDS [ levels - 1 ] ; if ( sax < 0 || sax > bounds . length ) { throw new RuntimeException ( "Invalid quantification symbol." ) ; } if ( sax > 0 && sax < bounds . length ) { if ( ! random ) { return 0.5D * ( bounds [ sax ] + bounds [ sax - 1 ] ) ; } else { double x = Math . random ( ) ; return x * bounds [ sax - 1 ] + ( 1.0D - x ) * bounds [ sax ] ; } } if ( 0 == sax ) { if ( ! random ) { return bounds [ 0 ] - 2.0D * ( bounds [ 1 ] - bounds [ 0 ] ) ; } else { return bounds [ 0 ] - Math . exp ( 1.0D / Math . random ( ) ) ; } } else { if ( ! random ) { return bounds [ bounds . length - 1 ] + 2.0D * ( bounds [ bounds . length - 1 ] - bounds [ bounds . length - 2 ] ) ; } else { return bounds [ bounds . length - 1 ] + Math . exp ( 1.0D / Math . random ( ) ) ; } } }
return an artificial value from a sax symbol and a given alphabet size ( 2 * * levels )
