rdrand

November 4, 2019

Last week (at the time of writing, anyway), Ars Technica reported a serious bug in AMD’s implementation of rdrand, an instruction that helps you generate random numbers. Apparently, on (some) Ryzen 3000, 0xfff…ff is “random”.

I recently got an AMD Ryzen 9 3900x, and I wondered if I have the bug as well.

Read the rest of this entry »


Random Points on a Sphere (Generating Random Sequences III, Revisited)

February 27, 2018

While searching for old notes—that I haven’t found anyway—I returned to an old blog entry and I thought I was kind of unsatisfactory, with be best part being swept under the carpet with a bit a faery dust, and very handwavingly.

So let’s work-out how to uniformly distribute points on a sphere in a more satisfactory fashion.

Read the rest of this entry »


r4nd0m pa$$w0rd

March 14, 2017

Let’s take it easy this week. What about we generate random passwords? That should be fun, right?

dice

Read the rest of this entry »


Making a good random table

April 5, 2016

I am still experimenting with hash functions, and I was toying with the Zobrist hash function[1] that is best known for its use in chess engines. The hash function is conceptually simple: you need a large table of random numbers, indexed, in a chess application, by the position on the board of the piece and by the piece itself. To compute a hash for a whole board configuration, you simply xor all the random numbers together. The hard part is choosing the random numbers.

IMG_0405-small

Read the rest of this entry »


Real dice.

March 1, 2016

Suppose you want to draw randomly a number between 0 and 1, with multiple throws of a six sided dice, what would you write down on its face?

dice

Read the rest of this entry »


The anatomy of hash functions (Hash functions, part II)

October 6, 2015

Before we go on exploring hash functions for look-up, let’s discuss their basic anatomy. This will give us some vocabulary as well as help us identify what are the important characteristics of good hash functions.

the-anatomy-lesson-small

Read the rest of this entry »


Hash Functions (Part I)

September 29, 2015

Hash tables are a great way of ensuring O(1) access to your data. Well, it does, but as long as the hash function is good.

7e4156dfac4d82e9a5cab4987ecc3a15

But what exactly makes a hash function a good hash function?

Read the rest of this entry »