This Scheme function, grc4, takes a string argument and returns a function of one integer input n. If rn is the yield of (grc4 keytext) then successive invocations of rn produces data from the RC4 cypher stream parameterized by the string keytext. (rn k) yields a random integer x such that 0 ≤ x < 256k.

The other functions there are

(pr s)
prints a string s in hex. It is useful for debugging the code.
(Do n p)
invokes the procedure p, of one argument, once for each value of that argument from n−1 thru 0.
The five lines at the bottom are a meagre test that agrees with other RC4 implementations.

Some Scheme implementations define the random function described here.