Category Archives: Uncategorized

The distribution of “roll and keep” dice

Introduction Some role-playing games involve a “roll and keep” dice mechanic, where you roll some number of dice, but only “keep” a specified number of them with the largest values, where the result of the roll is the sum of … Continue reading

Posted in Uncategorized | Leave a comment

Snap card game probability

Introduction In the children’s card game Snap, a deck of cards is shuffled and divided as evenly as possible among two or more players. In alternating turns, each player deals a card from her stack onto a face-up pile in … Continue reading

Posted in Uncategorized | Leave a comment

Poker puzzle

A variant of this problem came up in discussion recently, that I think lends itself to attack via either mathematical “pencil and paper” or “write a program” analysis: What is the median poker hand? More precisely, among all possible five-card … Continue reading

Posted in Uncategorized | Leave a comment

Calling Java from MATLAB with pass-by-reference arrays

MATLAB has a pretty intimate connection with Java, supporting the creation and manipulation of native Java objects directly in MATLAB source code. For example: Contrast this with C++, where it is typically necessary to write an additional small amount of … Continue reading

Posted in Uncategorized | 4 Comments

How to tell time using GPS, and the recent Collins glitch

Introduction Last week on Sunday 9 June, hundreds of airplanes experienced a failure mode with some variants of the Collins Aerospace GPS-4000S sensor, grounding many business jets and even causing some delays among regional airlines. Following is the initial description … Continue reading

Posted in Uncategorized | 3 Comments

A potential exploit of a Mountain Dew promotion

Introduction This past Monday marked the start of a 10-week promotion where you can buy bottles of Mountain Dew, each with a label showing one of the 50 United States. Collect all 50 state labels, and win $100 (in the … Continue reading

Posted in Uncategorized | 9 Comments

Tracking heap memory use in Windows

Introduction I recently encountered a problem with a C++ program that was allocating more memory than it should. It wasn’t leaking memory– that is, the program was well-behaved in the sense of eventually releasing every byte of memory that it … Continue reading

Posted in Uncategorized | 1 Comment