Welcome to tobilehman.com!
%  

wasm posts

Generating random numbers in C

Assume your range is lower to upper, both of type int. Choose random number in range A random integer, uniformly distributed, over that interval is generated with: int random_number(int lower, int upper) { return (rand() % (upper - lower + 1)) + lower; } But in C, the rand() function is deterministic. That means that if you don’t “seed” the random number generator (RNG), then it will return the same sequence every time.

Compiling C to WebAssembly

Ten years ago, a coworker tried to teach me cribbage on my last day at work, but I didn’t get it. The following year, I met my future wife, and she was a cribbage fan. She taught me, and I’ve loved the game ever since. Six years ago, I wrote this cribbage score calculator in C. It takes a string like JH 2C 3C 3S JS, and returns the full accounting of the score in a game of cribbage.

The Dream of the 90s is alive in WebAssembly

The year is 1996, Bill Clinton is president, the World Wide Web is 7 years old, and Sun Microsystems releases Java 1.0. Sun Microsystems markets Java to the world as the ultimate in software portability, so that programmers can Write Once, Run Everywhere. Assuming, of course, that you have first downloaded the Java Runtime, and enabled the Java plugin in your browser. The dream is that Java will enable people to create portable programs, so that a person with a web browser could download a new application without having to wait for a CD to arrive in the mail.