tcl::c...:random(3tcl)

πŸ“¦
version 2.0 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ tcl::chan::random β€” the random channel era ✨

okay so bestie, this is the page for tcl::chan::random, and it lives in the 3tcl manual section of Tcllib. it's giving pure Tcl chaos generator and honestly? iconic. let's get into it πŸŽ€


🌸 NAME 🌸

tcl::chan::random β€” Random channel. that's it, that's the whole vibe. a channel that's just... random. no cap.


✨ SYNOPSIS ✨

package require Tcl 8.5 9

package require TclOO

package require tcl::chan::events ?1.1?

package require tcl::chan::random ?1.1?

::tcl::chan::random seed

like, you do need Tcl 8.5 or 9, and you do need TclOO. no skipping steps bestie πŸ’…


πŸ’– DESCRIPTION πŸ’–

so the tcl::chan::random package hands you a command that creates random channels. what's a random channel, you ask? it's a read-only channel that, when you read from it, just keeps giving you an infinite stream of pseudo-random characters. infinite!! it never runs out. main character energy fr fr 🌈

this is lowkey similar to the random channels that the package Memchan provides β€” except (and this is the tea β˜•):

  • this one is written in pure Tcl, not C
  • it also uses a much simpler generator

on the other hand, Memchan is usable with Tcl 8.4 and before, whereas this package requires Tcl 8.5 or higher, plus TclOO. so like, pick your fighter based on your Tcl version, iykyk πŸ¦‹

also, the internal TclOO class that implements the channel handler is a sub-class of the tcl::chan::events framework. cute little family tree, obsessed πŸ’œ


🫢 API 🫢

  • ::tcl::chan::random seed β€” this command creates a brand new random channel and returns its handle (yes, you need that handle, don't lose it bestie πŸŽ€). the seed is a list of integer numbers that gets used to initialize the internal feedback shift register of the generator. so that's where the randomness starts, periodt ✨

πŸ’€ BUGS, IDEAS, FEEDBACK πŸ’€

ngl, this document β€” and the package it describes β€” will undoubtedly contain bugs and other problems. it's not a flaw, it's a lifestyle 😭

please report them in the category virtchannel of the Tcllib Trackers:

http://core.tcl.tk/tcllib/reportlist

and please also report any ideas for enhancements you may have for either the package and/or the documentation. we love a glow-up suggestion 🧚

when you're proposing code changes, please provide unified diffs β€” i.e. the output of:

diff -u

also note: attachments are strongly preferred over inlined patches. you can make an attachment by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. that's the one. the left-most one. slay πŸ’…


πŸ”₯ KEYWORDS πŸ”₯

/dev/random, random, reflected channel, tip 219, virtual channel


πŸ‘‘ CATEGORY πŸ‘‘

Channels


Copyright (c) 2009 Andreas Kupries <andreas_kupries@users.sourceforge.net>


ok that's the whole page bestie, you're officially a random channel expert πŸ’–βœ¨

this was the tcl::chan::random page from Tcllib 1.1 in the 3tcl manual β€” mwah, go read something else now, ily πŸ«ΆπŸŽ€πŸ¦‹

πŸ“¦ where this page comes from