💾 Archived View for thrig.me › blog › 2024 › 02 › 05 › noisetally.c captured on 2024-06-16 at 13:27:13.

View Raw

More Information

⬅️ Previous capture (2024-03-21)

-=-=-=-=-=-=-

#include <stdio.h>
#include <stdlib.h>

#include "jsf.h"

static const char noise[] = "..,`':;~+=< _ij\"^\\l(amxvu04PYW";

inline static char
rndchar(void)
{
	size_t index = 0;
	size_t len   = sizeof(noise) / sizeof(char);
	while (1) {
		size_t x = jsf_below(8);
		index += x;
		if (x < 5) break;
	}
	if (index >= len) index = 0;
	return noise[index];
}

int
main(void)
{
	jsf_init(arc4random());
	for (size_t i = 0; i <= 9999999; ++i)
		printf("%c\n", rndchar());
}