Documentation
¶
Overview ¶
Package words produces target strings for typing tests. It embeds a common-English word list and a curated quote pack so that the binary has no runtime filesystem or network dependencies.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForMode ¶
ForMode returns the target string for a typing test given the active mode and user-selected length. It is the primary entry point for Phase 4.
- ModeTime: length is the test duration in seconds (15/30/60/120); ForMode returns a large word buffer sized for the longest session. The length parameter is accepted for signature uniformity but does not affect buffer size — TimeBuffer always overshoots the maximum duration.
- ModeWords: length is the word count (10/25/50/100); returns exactly that many space-separated words.
- ModeQuote: ql selects the desired quote bucket; length is ignored.
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator is a seedable random word/quote source. Construct one with NewGenerator; the zero value is not valid.
func NewGenerator ¶
NewGenerator returns a Generator seeded with seed. If seed is 0 a unique time-based seed is chosen so each run differs.
func (*Generator) Quote ¶
Quote returns a random quote from the requested bucket using g's RNG. If the requested bucket is empty it falls back to the nearest non-empty bucket (medium → short → long).
func (*Generator) TimeBuffer ¶
TimeBuffer returns a large pool of space-separated words sized to outlast a 120-second test at high typing speed (timeBufferWords words). The caller (Phase 4 typing screen) may call TimeBuffer again to extend the pool if the user somehow exhausts it.