Usually three coin are used for divination. 3 is assigned as a value to the front of each coin, the 2 to the back. By tossing coins, the total value is 6, 7, 8 or 9, with 6 and 8 representing a broken line (yin) and 7 and 9 representing a solid line (yang). This process is repeated six times until the hexagram is complete.
The values 6 and 9 are regarded as changing lines, i.e. they change into their respective opposite: 6 (Yin) becomes 7 (Yang), 9 (Yang) becomes 8 (Yin). This transforms the original hexagram into another of the 64 hexagrams.
Read more: https://en.wikipedia.org/wiki/I_Ching_divination#Three-coin_method