this is an algorithm in wikipedia's defination:
A Markov chain is a stochastic model describing a sequence of possible events in which the probability of each event depends only on the state attained in the previous event. A countably infinite sequence, in which the chain moves state at discrete time steps, gives a discrete-time Markov chain.
by helping from @SSaurel
https://www.youtube.com/channel/UCXoh49OXVg1UGjgWX1JRvlw
hope enjoy it.