Posts Tagged random

C++ For C# Developers: Part 42 – Numbers Library

Tags: , , ,

There are so many kinds of numbers we deal with on a regular basis and the C++ Standard Library has a full suite of tools to deal with them. Today we’ll look into random numbers, ratios, mathematical constants, bit manipulation, complex numbers, and more!

Read the rest of this article »

2 Comments

Repeatable Random Performance

Tags: ,

A couple of years ago I posted a class that generats pseudo-random numbers in a repeatable way. This is useful for a variety of tasks, but a recent comment reminded me that I hadn’t tested its performance. Today I’ll pit my repeatable random function against the standard Math.random function as well as Skyboy’s repeatable random class. Read on for the results!

Read the rest of this article »

20 Comments

Repeatable Random

Tags:

Everybody knows about Math.random(), and for good reason. It’s pretty much the way to get random numbers in AS3, AS2, and JavaScript other than bizarre alternatives like AS3’s BitmapData.noise(). However, it has one critical problem that arises when you want to repeat a certain test or prevent game cheaters from exploiting the randomizer until they get an “easy” setup or desirable outcome. This problem is the lack of repeatability.

Read the rest of this article »

10 Comments