I Ching divination is a form of cleromancy applied to the I Ching. The text of the I Ching consists of sixtyfour hexagrams: sixline figures of yin (broken) or yang (solid) lines, and commentaries on them. There are two main methods of building up the lines of the hexagram, using either 50 yarrow stalks or three coins. Some of the lines may be designated "old" lines, in which case the lines are subsequently changed to create a second hexagram. The text relating to the hexagram(s) and old lines (if any) is studied, and the meanings derived from such study can be interpreted as an oracle.
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.^{[relevant?]}
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 the right hand 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 it remains a 6 (moving yin); otherwise, treat it as 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 a 7—reflip the marked coin: if it remains heads, then it remains as a 7 (static yang); otherwise, it becomes a 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 yin to static yin from 1:3 to 1:7; likewise, it changes the ratio of moving yang to static yang 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.
A modified version of the twocoin method improves on the original on several aspects. First, while maintaining the probabilities of the traditional yarrowstalk method, it simplifies outcomes such that they become intuitive at first sight, without need of further calculations. Second, it reduces the average number of coin throws per hexagram by 25%, from 12 to 9. It does so by requiring to throw the coins a second time only if both coins land on the same face (either both heads, or both tails), thus only in 50% of instances. Third, it is easy to memorize, as it clearly identifies heads with yang, and tails with yin, and a greater share of heads/tails with old (aka mature, moving, changing) yang/yin.
The modified twocoin method involves tossing one pair of coins of different size or shape. The larger, or heavier coin is assigned primacy (and is reported here as first, dominant, outcome) while the outcome of the smaller one comes second. Let H be heads and T tails.
If the coins land H, T, yang dominates and the outcome is young yang, unchanging. There is no need to throw the coins again for the same line.
If the coins land T, H, then yin dominates and the outcome is young yin, unchanging. Again, there is no need to throw the coins again for the same line.
If the coins land both on heads (H, H) then the outcome is for sure yang, but one must throw again to verify if the yang is changing (aka old) or unchanging (young). In case the second throw yields at least one H (either H, H, or H, T, or T, H), then the yang is changing. If both coins land on T (T, T) at second throw then the yang is unchanging.
If the coins land both on tails (T, T) then the outcome is for sure yin, but one must throw again to verify if the yin is changing or unchanging. In case the second throw yields both tails (T, T), then the yin is changing. If any of the two coins lands on H (either H, T, or T, H, or H, H) at second throw then the yin is unchanging.
The modified twocoin method yields old yang (changing) 3/16 of the times. Unchanging yang 5/16 times, and unchanging yin 7/16. The remaining 1/16 outcomes is old yin (changing).
It is considered simplified as it reduces the number of throws and calculations needed to correctly identify the outcome of each hexagram line, compared to any other method. While this has its advantages, some purists consider the time required to build the hexagram as a fundamental aspect of I Ching divination, for its ceremonial as well as introspective purposes. This said, any other coin based method can be considered similarly lacking on this regard, when compared to the yarrowstalk method.
As is the case for the conventional twocoin method and the four coin method, the simplified twocoin method can be boiled down to binary numbers, simply interpreting any H as 1 and any T as 0. Then, old yin takes value of 0000 (0 in decimal numbers), unchanging yin values between 0001 and 0111 (1 to 7), unchanging yang those between 1000 and 1100 (8 to 12), and old yang from 1101 to 1111 (13 to 15). This also clearly showcases the relative probabilities of each outcome.
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.
Coins  Binary  Decimal  Line 
T T T T  0000  0  
T T T H  0001  1  
T T H T  0010  2  
T T H H  0011  3 
Coins  Binary  Decimal  Line 
T H T T  0100  4  
T H T H  0101  5  
T H H T  0110  6  
T H H H  0111  7 
Coins  Binary  Decimal  Line 
H T T T  1000  8  
H T T H  1001  9  
H T H T  1010  10  
H T H H  1011  11 
Coins  Binary  Decimal  Line 
H H T T  1100  12  
H H T H  1101  13  
H H H T  1110  14  
H H H H  1111  15 
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.
Main articles: Chinese fortune telling, Chinese astrology, Symbolic stars, and Zi wei dou shu 
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, "The I Ching in Time and Space", I Ching: an annotated bibliography, p. xiii
The eleventhcentury NeoConfucian philosopher Shao Yung contributed advanced methods of divination including the Plum Blossom Yi Numerology, a horary astrology^{[4]} 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.^{[5]} Chu and Sherrill provide five astrological systems in An Anthology of I Ching^{[6]} and in The Astrology of I Ching^{[7]} 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.^{[4]} 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.^{[4]}
Main article: Wen Wang Gua 
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).^{[8]}
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.^{[9]}
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%.