Date: | October 20, 2005 / year-entry #313 |
Tags: | code |
Orig Link: | https://blogs.msdn.microsoft.com/oldnewthing/20051020-11/?p=33693 |
Comments: | 5 |
Summary: | Jensen Harris's brief example of using Excel's random number generator reminded me that I had need for the random number generator recently myself: Generating buzzword bingo cards. At the Battlestar Galactica party, our hosts needed to create some Battlestar Galactica-themed buzzword bingo cards and asked me to help out. Here's how I did it: Build... |
Jensen Harris's brief example of using Excel's random number generator reminded me that I had need for the random number generator recently myself: Generating buzzword bingo cards. At the Battlestar Galactica party, our hosts needed to create some Battlestar Galactica-themed buzzword bingo cards and asked me to help out. Here's how I did it:
It's not beautiful, but it gets the job done. |
Comments (5)
Comments are closed. |
I use Excel for the otherwise tedious job of pasting static initialization data into C/C++/C# programs.
Copy the data into a column (or columns) in Excel. In an adjacent column, create an expression that adds quotes, curly brackets, commas, etc. to the first data item.
Duplicate the expression down its column and copy the resulting data into the C program.
I wrote a little program to stream STDIN/STDOUT to and from the clipboard. I can then highlight a block of variables or code, copy to the clipboard, alt-tab to a CMD shell and type like:
clipboard -o | awk "{ print "{" $3 "," $5 "}," }" | clipboard -i
Or whatever. sort, awk, sed, grep, uniq, perl all come in handy here.
I never though of using excel though. Interesting idea.
"Canned" random number generators are dangerous things. Keno games at a casino (if I recall, in Montreal, Quebec) have been broken because the programmers were lazy, and used the random function supplied with the program.
There was a really good pseudo-random-number generator discussion and code in the April or May 1989 issue of Byte.
It was random enough so that there were duplicate numbers created in the sequence, but pseudo enough so that with the same seeds, the same sequence was produced.
I’m reminded by the old adage "When all you have is a hammer, everything looks like a nail."
I confess — I wrote a Perl CGI script to generate HTML buzzword bingo cards, checking for uniqueness, too…