The Tao of Java
Generating Random Hexangrams
By Mike Fichtelman
Throughout time, people have invented different ways to understand and cope with change. The ancient Chinese were no exception. Chinese philosophers called "Taoists" believed there were two primordial states, yin and yang, and that the tension between the two dynamically creates all that exists. From this belief, they evolved a philosophy of change, which is embodied in the classic I Ching,or Book of Changes. The fundamental theme of the I Ching is that each facet of a particular moment in time, no matter how large or small, is a perfect reflection of that moment. Ancient Chinese scholars and philosophers symbolized each moment as a hexagram, and the I Ching is a compendium of the 64 hexagrams they developed.
Traditionally, the lines of a hexagram were generated using the "long" or "short" methods. The more-ancient long method involves the sequential sorting and selection of yarrow stalks. The short method involves the use of three coins, thrown six times. From a simple formula, one may derive a moving or unmoving yin (solid) line, or a moving or unmoving yang (broken) line.
Figure 1 shows hexagram 57, called "Sun." Once a hexagram is obtained, the text of the I Ching is consulted in order to understand its meaning.
The I_Ching Applet
The I_Ching.java applet in