UNPKG

uwurandom

Version:

`/dev/urandom` is made out of cold hard math. Instead, consider using `/dev/uwurandom`, which generates data through a tiny catgirl furiously typing away utter nonsense inside your computer.

45 lines (44 loc) 1.2 kB
/** * Stateful uwurandom generator. */ export declare class UwurandomState { private readonly ptr; constructor(); /** * Generate cat nonsense into the provided buffer. * @param dest A buffer, allocated within this instance. */ generate(dest: DestBuffer): void; /** * Destroy this generator, freeing its underlying WASM memory. */ destroy(): void; } /** * Memory allocation within this WASM instance, used for writing cat * nonsense into. */ export declare class DestBuffer { private readonly ptr; private readonly size; /** * Allocate a new buffer. * @param size The size, in bytes, of this buffer. */ constructor(size: number); /** * @returns This buffer as a {@link Uint8Array} view into the underlying * WASM memory. Note that allocating further {@link DestBuffer}s or * {@link UwurandomState}s may grow the WebAssembly memory and * invalidate this array view! */ asTypedArray(): Uint8Array<ArrayBuffer>; /** * @returns The text contents of this buffer. */ asText(): string; /** * Free this buffer's underlying WASM memory. */ destroy(): void; }