PathrockNetwork Gno Explorer
HomeBlocksTransactionsRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/p/moul/x/daily/markov/v0

Package
Open in gnoweb ↗

Overview

Kind
Pure package
Name
v0
Namespace
moul / x / daily / markov
Files
3 (README)(gnomod.toml)
Exported functions
n/a — not supported for pure packages by the node (vm/qfuncs)
Module
gno.land/p/moul/x/daily/markov/v0
gno
0.9

Files (3)

  • README.mdmarkdown
  • gnomod.tomltoml
  • markov.gnogno
README.mdPreviewRaw
# `gno.land/p/moul/x/daily/markov/v0`

**Deterministic Markov-chain text generator** — a port of Go's canonical example
[*"Generating arbitrary text: a Markov chain algorithm"*](https://go.dev/doc/codewalk/markov/)
with `math/rand` replaced by a caller-supplied seed.

A `Chain` maps every two-word *prefix* to the list of words observed to follow
it (duplicates kept, so frequency biases the walk), storing that map in a
persistent `avl.Tree`. `Build` folds text into the chain; `Generate` walks it
from the start prefix, picking one suffix per step from a small LCG seeded by
the `uint64` you pass — so generation is pure and replayable, and the caller
decides where entropy comes from (on-chain, the block height). No chain imports,
no ambient state.

```go
import "gno.land/p/moul/x/daily/markov/v0"

c := markov.New()
c.Build("it was the best of times it was the worst of times") // fold in a corpus
words := c.Generate(40, seed)                                  // walk it, seeded
c.Stats()                                                      // (totalWords, prefixCount)
c.Iterate(func(prefix string, suffixes []string) bool { ... }) // inspect the map
```

**Live demo:** [`r/moul/x/daily/markovdemo`](https://github.com/moul/gno-contracts/tree/main/r/moul/x/daily/markovdemo/v0)
· render it at [`/r/moul/x/daily/markovdemo/v0`](https://gno.land/r/moul/x/daily/markovdemo/v0).

<!-- BEGIN GNOCONTRACTS FOOTER (generated by `make readmes`; do not edit below) -->

---

Part of **[moul/gno-contracts](https://github.com/moul/gno-contracts)** — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

**Dependency graph:**

![gno.land/p/moul/x/daily/markov/v0 dependency graph](https://raw.githubusercontent.com/moul/gno-contracts/main/_assets/gno.land/p/moul/x/daily/markov/v0/deps.png)

> 🧪 **Highly experimental — potentially vibe-coded.** Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: [DISCLAIMER](https://github.com/moul/gno-contracts/blob/main/DISCLAIMER.md).

<!-- END GNOCONTRACTS FOOTER -->

Functions

not supported for pure packages by the node (vm/qfuncs)

Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.