|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Examples.QuasiMonteCarlo.GrayCodeCounter
Prints the grey codes gray(n), n=1,2,...,299 computed both directly and recursivley by changing (XORing with 1) the relevant bit. Done to see how irregularly the grey counter runs through the integers.
Recall that we use gray code counting to move through the integers in our implementations of low discrepancy sequences based on base b=2.
Constructor Summary | |
GrayCodeCounter()
|
Method Summary | |
static int |
gray(int n)
The Gray code of n. |
static void |
main(java.lang.String[] args)
|
static void |
printbin(int n)
Print binary string representation of a positive integer n. |
static int |
thebit(int n)
|
static int |
twopower(int j)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public GrayCodeCounter()
Method Detail |
public static void printbin(int n)
public static int thebit(int n)
public static int twopower(int j)
public static int gray(int n)
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |