Random Values (WASM)

This experiment was originally written in C++ and compiled to WASM using Emscripten (Blog post about making it a WASM library). I wanted to make random value generators for both simple data elements (numbers, ASCII strings, etc) and more complex data elements (e.g. URLs, emails, etc). I wanted to use these data generators as part of a property testing framework I've been building as a learning experiment (Blog post about making property test framework).

The PRNG I used is the TinyMT algorithm (it's pretty small for memory usage). I'm not using my full TypeScript wrapper for this particular page (the wrapper handles all memory management automatically). Instead, I'm manually managing the memory directly. I'm not doing a lot, and I didn't want to add another build/bundle step for this experiment, so I opted to keep it simple - even if it does mean manual memory management in JavaScript.

Not every random value generator I've made is shown here on this page. But it's enough to show the different types of generators I'm using. As for the state and interactions, I'm just using Vanilla JavaScript to create each demonstration section and wire up on-click handlers. There isn't any sort of Redux, React, Vue, etc going on. It's pretty barebones and simple since I was more interested in using a WASM library rather complicate the JavaScript side. I also didn't want to have the full page written in WASM since this is meant to show a WASM library and not a WASM application.