Skipping

Of the two C language keyword looping statements, for is the most traditional and probably the most popular. It’s also the most frustrating for beginners because of its many parts. But eventually, a comfort level arises with using the for loop, which is sad because it’s more powerful than a simple counter.
Continue reading

C Language Neat Tricks #1

The C language holds the potential of being utterly terrifying, which is something I admire greatly. Many beginners, as well as foolhardy travelers from other languages, treat a lot of the C language constructs as absolutes when, in fact, they aren’t. Therefore I present this week’s Lesson, the first in an ongoing series about strange, beautiful, and frightening things in the C language.
Continue reading

Weighted Random Numbers

Random numbers are useful when simulating information and they add a degree of unpredictability to computer games. The problem programmers run into, especially with simulation, is that not everything is truly random. In many cases, some numbers need to be more random than others. The solution is to generate weighted random numbers.
Continue reading