# Markov Chain in p5.js

**URL:** <https://discourse.processing.org/t/markov-chain-in-p5-js/43399>\
**Category:** Coding Questions\
**Created:** [December 5, 2023, 3:39pm UTC](https://discourse.processing.org/t/markov-chain-in-p5-js/43399 "2023-12-05T15:39:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![abkeil](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@abkeil](https://discourse.processing.org/u/abkeil)\
**Post date:** [December 5, 2023, 3:39pm UTC](https://discourse.processing.org/t/markov-chain-in-p5-js/43399/1 "2023-12-05T15:39:22Z")

</div>

Hello,

I am interested in creating a project that uses a markov chain. I have edited this example a bit: [p5.js Web Editor](https://editor.p5js.org/abkeil/sketches/QNfzcfQ3K).

Whereas right now the code features a generate button and produces a list, I would like for a screen to show only one result at a time, for a few seconds, and then be replaced by a new string. Ideally, this can be set off by sensors using arduino but that’s further down the line. Thanks for any feedback!
