Sign inDemoInstall

Package Overview
File Explorer

Install Socket

Protect your apps from supply chain attacks


Generating random text: a Markov chain algorithm Based on the program presented in the "Design and Implementation" chapter of The Practice of Programming (Kernighan and Pike, Addison-Wesley 1999). See also Computer Recreations, Scientific American 260, 122 - 125 (1989). A Markov chain algorithm generates text by creating a statistical model of potential textual suffixes for a given prefix. Consider this text: Our Markov chain algorithm would arrange this text into this set of prefixes and suffixes, or "chain": (This table assumes a prefix length of two words.) To generate text using this table we select an initial prefix ("I am", for example), choose one of the suffixes associated with that prefix at random with probability determined by the input statistics ("a"), and then create a new prefix by removing the first word from the prefix and appending the suffix (making the new prefix is "am a"). Repeat this process until we can't find any suffixes for the current prefix or we exceed the word limit. (The word limit is necessary as the chain table may contain cycles.) Our version of this program reads text from standard input, parsing it into a Markov chain, and writes generated text to standard output. The prefix and output lengths can be specified using the -prefix and -words flags on the command-line.


Version published


An Ironic Dream

A Twitter bot, [@anironicdream](, based on [Donna Haraway's Cyborg Manifesto]( ([alternate link]( 

Go code yanked from the [Codewalk Markov chain example]( and the [twittergo tweet example](

To use this bot, you need a four-line file called `CREDS` in the directory where you run the bot. `CREDS` must contain your Consumer Key, Consumer Secret, Access Token, and Access Token Secret, in that order, separated by new lines. To get those visit To run the bot, use standard in, so on a Unix system:

    cyborgmanifesto < aCyborgManifesto.txt

I'm new to Go, but I think if you clone this repo, cd into it, and run `go install` you should get an executable with the name of this repository, unless you changed the name when you cloned it. If you `go get` and then `go install` you should have a `cyborgmanifesto` executable in `$GOPATH/bin`. [How to Write Go Code](, and the Go documentation in general, clarify matters well.


Last updated on 12 Jun 2014

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.


Related posts

SocketSocket SOC 2 Logo


  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc