Among the many forms of divination is a cleromancy that is applied to the I Ching (易經, yì jīng) or Book of Changes. The text of the I Ching consists of sixtyfour hexagrams—sixline figures—and commentaries upon them. By using one or another of several methods, one randomly generates the six lines; one then studies the commentaries in the I Ching associated with the generated hexagram. The meanings derived from such study can be interpreted as an oracle.
Oracular uses of the I Ching—changing lines and resulting changed hexagrams—are documented before and around the Warring State period. The practice is earlier than many schools of Chinese philosophy, including that of Confucius (he himself, or in any event his school, studied the I Ching and tried to interpret it). The I Ching was also used by later schools, such as the School of YinYang. As the I Ching was one of only a few books that were not burnt, and it enjoyed for more than two millennia the status of one of the five key books that had to be studied as preparation for the examinations of government officials, the traditions of its rules and interpretation have continued to the present.
Throughout China's region of cultural influence (including Japan, Korea, and Vietnam), scholars have added comments and interpretations to the I Ching. It has also attracted the interest of many thinkers in the West; historical and philosophical information, as well as a list of English translations, can be found here. The text is extremely dense reading—in fact, the original interpretation of the oracle is based not only on the groupings of six lines (the hexagrams), but also on groups of three lines (trigrams, in terms of which each hexagram can be analysed) and even pairs of lines (bigrams).
Each hexagram is six lines, written sequentially one above the other; each of the lines represents a state that is either yin (陰 yīn: dark, feminine, etc., represented by a broken line) or yang (陽 yáng: light, masculine, etc., a solid line), and either old (moving or changing, represented by an "X" written on the middle of a yin line, or a circle written on the middle of a yang line) or young (static, unchanging). The usual methods for consulting the I Ching as an oracle produce a "sacred" or "ritual" number for each type of line: 6 (for an old yin line), 7 (young yang), 8 (young yin), or 9 (old yang). The six lines are produced in order using the chosen method (see below for examples), beginning at the first (lowest) one and proceeding upward to the sixth (uppermost) line, each with its corresponding number. Then, the commentaries applying to the generated hexagram are studied; if the hexagram contains no old lines at all, that concludes the consultation, but if there are one or more old lines, the separate commentary for each such line is also studied. Then, the lines are appropriately changed (any old yin lines into young yang lines, and any old yang lines into young yin lines), which—with the young lines in the original hexagram remaining the same—results in a second, different, hexagram, the commentarial material on which is then also studied.
The method used by the diviner to generate the hexagram(s) depends on their circumstances and beliefs; the yarrowstalk method is usually employed by traditionalists who find significance in its complexity, and in the resulting time needed to manipulate the stalks to produce a hexagram. Coin methods, and others, are used either by those short of time, or by fortunetellers who need a quick reading. There are also methods to generate a hexagram by interpreting the time, direction, person, etc., instead of throwing coins or dividing and counting yarrow stalks. Several of the methods described below force exactly one, or no, moving lines; the traditional yarrowstalk method allows from zero to six moving lines. The yarrowstalk method favours static lines over moving lines in the ratio 3:1.
Plastromancy or the turtleshell oracle is probably the earliest recorded form of fortune telling. The diviner would apply heat to a piece of a turtle shell (sometimes with a hot poker), and interpret the resulting cracks. The cracks were sometimes annotated with inscriptions, the oldest Chinese writings that have been discovered. This oracle predated the earliest versions of the Zhou Yi (dated from about 1100 BC) by hundreds of years.
A variant on this method was to use ox shoulder bones, a practice called scapulimancy. When thick material was to be cracked, the underside was thinned by carving with a knife.
Hexagrams may be generated by the manipulation of yarrow stalks. These are usually genuine Achillea millefolium stalks that have been cut and prepared for such purposes, or any form of wooden rod or sticks (the quality ranging from cheap hardwood to very expensive red sandalwood, etc.) which are plain, lacquered, or varnished. When genuine Achillea is used, varieties local to the diviner are considered the best, as they would contain qi closer to, and more in tune with, the diviner, or they may come from a particularly spiritual or relevant place, such as on the grounds of a Confucian temple. When not in use, they are kept in a cloth or silk bag/pouch or a wooden case/box.
Fifty yarrow stalks are used, though one stalk is set aside at the beginning and takes no further part in the process of consultation. The remaining fortynine stalks are roughly sorted into two piles, and then for each pile one stalk is initially "remaindered"; then the pile is "cast off" in lots of four (i.e., groups of four stalks are removed). The remainders from each half are combined (traditionally placed between the fingers of one hand during the counting process) and set aside, with the process then repeated twice (i.e., for a total of three times). The total number of stalks in the remainder pile will necessarily (if the procedure has been followed correctly) be 9 or 5, in the first count, and 8 or 4, in the second. 9 or 8 is assigned a value of 2; 5 or 4, a value of 3. The total of the three passes will be one of just four values: 6 (2+2+2), 7 (2+2+3), 8 (2+3+3), or 9 (3+3+3)—that value is the number of the first line.^{[1]} The fortynine stalks are then gathered and the entire procedure repeated to generate each of the remaining five lines of the hexagram.
The yarrowstalk method produces unequal probabilities^{[2]}^{[3]} for obtaining each of the four totals, as shown in the table. Compared to the threecoin method discussed next, the probabilities of the lines produced by the yarrowstalk method are significantly different.
Number  Yarrowstalk probability  Threecoin probability  yin or yang  Signification  Symbol  

6  1/16  8/16  2/16  8/16  old yin  yin changing into yang  
8  7/16  6/16  young yin  yin, unchanging  
9  3/16  8/16  2/16  8/16  old yang  yang changing into yin  
7  5/16  6/16  young yang  yang, unchanging 
Note that the Yarrow algorithm is a particular algorithm for generating random numbers; while it is named after the yarrowstalk method of consulting the I Ching, its details are unrelated to it.
The threecoin method came into use over a thousand years after the yarrowstalk method. The quickest, easiest, and most popular method by far, it has largely supplanted yarrow stalks, but produces outcomes with different likelihoods. Three coins are tossed at once; each coin is given a value of 2 or 3, depending upon whether it is tails or heads, respectively. Six such tosses make the hexagram. Some fortunetellers use an empty tortoise shell to shake the coins in before throwing them on a dish or plate.
The threecoin method can be modified to have the same probabilities as the yarrowstalk method by having one of the coins be of a second coin type, or in some way be marked as special (i.e., be distinguishable from the other coins). All three coins are tossed at once. The results are counted just as in the original threecoin method, with two exceptions: one to make yin less likely to move, and one to make yang more likely to move. (The probability for 6/8/9/7 in the coin method is 2/6/2/6, but in the yarrowstalk method is 1/7/3/5; hence, 6 has to occur less often, and 9 has to occur more often.)
In the case where the special coin is tails and the other two are both tails—which would normally produce a 6—reflip the marked coin: if it remains tails, then treat it as a 6 (moving yin); otherwise, it remains an 8 (static yin). As a 6 can become a 6 or an 8, it reduces the probability of the moving 6. In other words, it makes the old yin less likely to change (or move).
In the case where the special coin is heads and the other two are both tails—which would normally produce an 7—reflip the marked coin: if it remains heads, then treat it as a 7 (static yang); otherwise, it remains an 9 (moving yang). As a 7 can become a 7 or an 9, it reduces the probability of the static 7. In other words, it makes the young yang less likely and hence more yangs change as a result.
This method retains the 50% chance of yin:yang, but changes the ratio of moving yang to static yang from 1:3 to 1:7; likewise, it changes the ratio of moving yin to static yin from 1:3 to 3:5, which is the same probabilities as the yarrowstalk method.
Some purists contend that there is a problem with the threecoin method because its probabilities differ from the more ancient, yarrowstalk, method. In fact, over the centuries there have even been other methods used for consulting the oracle.
The twocoin method involves tossing one pair of coins twice: on the first toss, two heads give a value of 2, and anything else is 3; on the second toss, each coin is valued separately, to give a sum from 6 to 9, as above. This results in the same distribution of probabilities as for the yarrowstalk method.
With tails assigned the value 0 (zero) and heads the value 1, four coins tossed at once can be used to generate a fourbit binary number, the rightmost coin indicating the first bit, the next coin (to the first's left) indicating the next bit, etc. The number 0000 is called old yin; the next three numbers—0001, 0010, and 0011 (the binary numbers whose decimal equivalents are 1, 2, and 3, respectively)—are called old yang, with a similar principle applied to the remaining twelve outcomes. This gives identical results to the yarrowstalk method.




The twocoin method described above can be performed with four coins, simply by having one pair of coins be alike—of the same size or denomination—while the other two are of a different size or denomination; the larger coins can then be counted as the first toss, while the two smaller coins constitute the second toss (or vice versa).
Six coins—five identical coins and one different—can be thrown at once. The coin that lands closest to a line drawn on the table will make the first line of the hexagram, and so on: heads for yang, tails for yin. The distinct coin is a moving line. This method has the dual failings that (1) it forces every hexagram to be a changing hexagram, and (2) it only ever allows exactly one line to be changing.
Eight coins, one marked, are tossed at once. They are picked up in order and placed onto a Bagua diagram; the marked coin rests on the lower trigram. The eight process is repeated for the upper trigram. After a third toss, the first six coins are placed on the hexagram to mark a moving line. This has the deficiency or allowing at most one moving line, whereas all six lines could be moving in traditional methods.
Any dice with an even number of faces can also be used in the same fashion as the coin tosses, with even die rolls for heads and odd for tails. An eightsided die (d8) can be used to simulate the chances of a line being an old moving line equivalent to the yarrowstalk method. For example, because the chances of any yin line or any yang line are equal in the yarrowstalk method, there is a oneineight chance of getting any basic trigram, the same chance held under the ba qian method, so the ba qian method can be used to determine the basic hexagram. The d8 can then be used by rolling it once for each line to determine moving lines. A result of 1 on a yin line, or 3 or less on a yang line, will make that line a moving line, preserving the yarrowstalk method's outcomes.
Another dice method that produces the 1:7:3:5 ratio of the yarrowstalk method is to add 1d4 + 1d8. All odd results are considered yin, with the result of 11 denoting an old yin. Any even results would be considered yang, with both 4 and 10 treated as old yang.
Two dice methods that not only produce the yarrowstalk probabilities but maintain the traditional even–odd associations of yin and yang are the 3d4 and 2d8 methods. In the 3d4 method, one rolls three foursided dice and adds their outcomes, treating all odd totals as yang and all even totals as yin, with totals of 4, 7, and 12 indicating a moving line. The 2d8 method works analogously for two eightsided dice, but here, any total over 10 (with the exception of 12) is considered moving.
(See article: Long Dice)
A recent innovation in I Ching divination—長色子 zhǎng shǎizi, "long dice"—is a variation on older dicerolling methods using a set of three specially made dice. The longdice method was created by an artisan in the United States to mimic the probabilities of the traditional yarrowstalk method. The long dice each have four faces marked with either two or three dots, called "pips". Two of the zhǎng shǎizi are identical, and possess equal probabilities of rolling a 2 or a 3; the final die has three sides with three pips and one side with two pips. The dice are cast six times to obtain the six lines of an I Ching hexagram.
Sixteen marbles can be used in four different colours. For example:
The marbles are drawn with replacement six times to determine the six lines. The distribution of results is the same as for the yarrowstalk method.
^{[4]}
For this method, either rice grains or small seeds are used. Six small piles of rice grains are made by picking up rice between finger and thumb. The number of grains in a pile determines if it is yin or yang. The rice grain method doesn't mark any lines as moving, while the traditional yarrow method can mark any of the six lines as moving.
There is a tradition of Taoist thought which explores numerology, esoteric cosmology, astrology and feng shui in connection with the I Ching.
The Han period (206 BCE220 CE)… saw the combination and correlation of the I Ching, particularly in its structural aspects of line, trigrams, and hexagrams, with the yinyang and wu hsing (Five Element) theories of the cosmologists, with numerical patterns and speculations, with military theory, and, rather more nebulously, with the interests of the fangshih or "Masters of Techniques," who ranged over many areas, from practical medicine, through alchemy and astrology, to the occult and beyond.
— Hacker, Moore and Patsco, I Ching: an annotated bibliography, "The I Ching in Time and Space", p. xiii
The eleventhcentury NeoConfucian philosopher Shao Yung contributed advanced methods of divination including the Plum Blossom Yi Numerology, a horary astrology^{[5]} that takes into account the number of calligraphic brush strokes of one's query.^{[citation needed]} Following the associations Carl Jung drew between astrology and I Ching with the introduction of his theory of synchronicity, the authors of modern Yi studies are much informed by the astrological paradigm.^{[6]} Chu and Sherrill provide five astrological systems in An Anthology of I Ching^{[7]} and in The Astrology of I Ching^{[8]} develop a form of symbolic astrology that uses the eight trigrams in connection with the time of one's birth to generate an oracle from which further hexagrams and a daily line judgement are derived.^{[5]} Another modern development incorporates the planetary positions of one's natal horoscope against the backdrop of Shao Yung's circular Fu Xi arrangement and the Western zodiac to provide multiple hexagrams corresponding to each of the planets.^{[5]}
This method goes back to Jing Fang (78–37 BC). While a hexagram is derived with one of the common methods like coin or yarrow stalks, here the divination is not interpreted on the basis of the classic I Ching text. Instead, this system connects each of the six hexagram lines to one of the Twelve Earthly Branches, and then the picture can be analyzed with the use of 5 Elements (Wu Xing).^{[9]}
By bringing in the Chinese calendar, this method not only tries to determine what will happen, but also when it will happen. As such, Wen Wang Gua makes a bridge between I Ching and the Four Pillars of Destiny.
The preceding ("concrete"/physical) methods can be simulated in ("abstract"/conceptual) software. This has the theoretical advantage of improving randomness aspects of consulting the I Ching ("notdoing" in the personal sense, enhancing the "universal" principle). For all methods, one must prefocus/prepare the mind.
Here is a typical example for the "modified threecoin" method:
Python code for I Ching simulation


#!/usr/bin/env python3
#
# iChing_Modified_3_coins.py
#
# see https://github.com/kwccoin/IChingModified3CoinMethod
#
# Create (two) I Ching hexagrams: present > future (might be same).
#
# With both "3coin method" and "modified 3coin method" (see <nowiki>https://en.wikipedia.org/wiki/I_Ching_divination</nowiki>).
#
# 3coins Probabilities:
# old/changing/moving yin "6 : == x ==" = 1/8
# (young/stable/static) yang "7 : =======" = 3/8
# (young/stable/static) yin "8 : == ==" = 3/8
# old/changing/moving yang "9 : == o ==" = 1/8
#
# 3coins Probabilities:
# old/changing/moving yin "6 : === x ===" = 1/8
# (young/stable/static) yang "7 : =========" = 3/8
# (young/stable/static) yin "8 : === ===" = 3/8
# old/changing/moving yang "9 : ====o====" = 1/8
#
# Modified 3coins Probabilities:
# old/changing/moving yin "6 : === x ===" = 1/8 * 1/2 = 1/16
# (young/stable/static) yang "7 : =========" = 3/8  1/8*1/2 = 5/16
# (young/stable/static) yin "8 : === ===" = 3/8  P[6] = 7/16
# old/changing/moving yang "9 : ====o====" = 1/8  p[7] = 3/16
# see
# https://aleadeum.com/2013/07/12/theichingrandomnumbersandwhyyouaredoingitwrong/
# especially see the remark why 1st round are 1/43/4 whilst 2nd and 3rd round are 1/21/2
import random
def toss(method: str = "yarrow") > int:
"Toss."""
rng = random.SystemRandom() # Autoseeded, with os.urandom()
special_coin = 0
val = 0
for flip in range(3): # Three simulated coin flips i.e. coin 0, 1, 2
val += rng.randint(2,3) # tail=2, head=3 for each coin
if flip == 0:
special_coin = val # Coin 0 as the special coin
if method == "coin": # Coin method note tth or 223 is 7 or young yang
return val # Probability of 6/7/8/9 is 1/8 3/8 3/8 1/8
elif method == "modified 3 coins":
# method similar to "yarrowstick" need to have prob.
# for 6/7/8/9 as 1/16 5/16 7/16 3/16
# now coin method is
# for 6/7/8/9 as 2/16 6/16 6/16 2/16
# modified to change
# 1/16 1/16 +1/16 + 1/16
# 6 7 8 9
if ((val == 6) and (special_coin == 2)):
special_coin = rng.randint(2,3)
if (special_coin == 2):
val = 6
else:
val = 8
elif ((val == 7) and (special_coin == 3)):
special_coin = rng.randint(2,3)
if (special_coin == 3):
val = 7
else:
val = 9
return val # probability of 6/7/8/9 is 1/16 5/16 7/16 3/16
else: #yarrowstick method as effectively default
#start_sticks, skyleft, skyreminder, human, earthright, earthreminder, bin
#value> 49 0 0 0 0 0 0
#index> 0 1 2 3 4 5 6
# on table:
# heaven
# heavenleft human earthright
# earth
#
# sometimes use finger to hold above
def printys(ys, remark):
# String format example: f"Result: {value:{width}.{precision}}"
width=3
print(f'[{ys[0]}, \t{ys[1]}, \t{ys[2]}, \t{ys[3]}, \t{ys[4]}, \t{ys[5]}, \t{ys[6]}] \t{remark}')
return
def ys_round(ys, round, debug="no"):
if debug=="yes": print("Round is", round)
if debug=="yes": print("===============")
if debug=="yes": print(f'[{"src"}, \t{"sky"}, \t{"left"}, \t{"human"}, \t{"earth"}, \t{"right"}, \t{"bin"}] \t{"remark"}')
# Generate a number somewhere in between 1/3 to 2/3 as human do not trick
if debug=="yes": printys(ys, "Starting")
ys[1] = rng.randint(ys[0]//3,ys[0]*2//3)
ys[4] = ys[0]  ys[1]
ys[0] = ys[0]  ys[1]  ys[4]
if debug=="yes": printys(ys, "Separate into two")
ys[3] = 1
ys[1] = ys[1]  ys[3]
if debug=="yes": printys(ys, "and with one as human")
ys[2] = ys[1] % 4
if ys[2] == 0:
ys[2] = 4
ys[1] = ys[1]  ys[2]
if debug=="yes": printys(ys, "then 4 by 4 and sky behind ...")
ys[5] = ys[4] % 4
if ys[5] == 0:
ys[5] = 4
ys[4] = ys[4]  ys[5]
if debug=="yes": printys(ys, "then 4 by 4 and earth behind ...")
ys[6] += ys[2] + ys[3] + ys[5]
ys[2] = 0
ys[3] = 0
ys[5] = 0
ys[0] = ys[1] + ys[4]
ys[1] = 0
ys[4] = 0
if debug=="yes": printys(ys, "complete the cycle ...")
return ys
ys = [0, 0, 0, 0, 0, 0, 0] # May be better use dictionary
ys[0] = 55
# printys(ys, "The number of heaven and earth is 55")
ys[0] = 49
# printys(ys, "only 49 is used")
# Round 1 need to ensure mod 4 cannot return 0 and cannot have 0
# wiki said cannot have 1 as well not sure about that
ys = ys_round(ys, 1, "no") # "yes")
ys = ys_round(ys, 2, "no") # "yes")
ys = ys_round(ys, 3, "no") # "yes")
return (ys[0] // 4)
# We build in bottom to top
print("Method is yarrow by default\n")
toss_array = [0, 0, 0, 0, 0, 0]
for line in range(0,6,1):
toss_array[line] = toss()
print("Line is ", line+1, "; toss is ", toss_array[line], "\n")
# Hence we print in reverse
def print_lines_in_reverse(toss_array):
for line in range(5, 1, 1):
val = toss_array[line] # The changing line/hexagram need another program
if val == 6: print('6 : == x ==')#  == == > ')
elif val == 7: print('7 : ')#   > ')
elif val == 8: print('8 : == ==')#  == == > == ==')
elif val == 9: print('9 :  o ')#   > == ==')
print_lines_in_reverse(toss_array)
print("\n\n")

With a modified threecoin method as default, this may avoid the Sung dynasty issue, i.e., when you have an easily available and simple method, you use it—but with a wrong probability! (Also, the first number starts from the bottom like a hexagram.)
A JavaScript version of the Yarrow Stalk method, which generates slightly different probabilities, is available in open source form at GitHub.
Most analyses of the probabilities of either the coin method or yarrowstalk method agree on the probabilities for each method. The coin method varies significantly from the yarrowstalk method, in that the former gives the same probability to both of the moving lines and to both of the static lines, which is not the case in the yarrowstalk method.
However, the calculation of the frequencies for the yarrowstalk method—generally believed to be the same as those described in this article in the simplified method using sixteen objects—contains a further error, in the opinion of Andrew Kennedy,^{[10]} which is that of including the selection of zero as a quantity for either hand. The yarrowstalk procedure expressly requires that the four numbers be produced without using zero; Kennedy shows that by not allowing the user to select zero for either hand, or a single stalk for the right hand (this stalk is moved to the left hand before counting by fours, and so also leaves a zero in the right hand), the hexagram frequencies change significantly for a daily user of the oracle. Kennedy has modified the simplified method of using sixteen coloured objects described in this article as follows:
take 38 objects, of which
 8 are of one colour = moving yang
 2 are of a different colour = moving yin
 11 are of a different colour = static yang
 17 are of a different colour = static yin
This arrangement produces Kennedy's calculated frequencies within 0.1%.