randtxt

package
v0.5.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2021 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package randtxt supports the generation of random text using a trigram model for the English language.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GroupReader

type GroupReader struct {
	R             io.ByteReader
	GroupsPerLine int
	// contains filtered or unexported fields
}

GroupReader groups the incoming text in groups of 5, whereby the number of groups per line can be controlled.

func NewGroupReader

func NewGroupReader(r io.Reader) *GroupReader

NewGroupReader creates a new group reader.

func (*GroupReader) Read

func (r *GroupReader) Read(p []byte) (n int, err error)

Read formats the data provided by the internal reader in groups of 5 characters. If GroupsPerLine hasn't been initialized 8 groups per line will be produced.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader generates a stream of text of uppercase letters with trigrams distributed according to a language model of the English language.

func NewReader

func NewReader(src rand.Source) *Reader

NewReader creates a new reader. The argument src must create a uniformly distributed stream of random values.

func (*Reader) Read

func (r *Reader) Read(p []byte) (n int, err error)

Read reads random text. The Read function will always return len(p) bytes and will never return an error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL