Canada's RAND Immigration Lottery Not Random!
Written by Lucy Black   
Sunday, 17 June 2018

Well of course it isn't, but that doesn't stop people who should no better from stirring up a mock disgust and alarm. Oh dear we programmers are at it again, cutting corners with our job lot of not-quite-perfect random numbers.

I can remember standing in a bookshop smirking at a copy of A Million Random Digits (with 100,000 Normal Deviates) and smiling even more when I noticed it was a publication of the RAND Corporation. You can still buy it - see the right-hand side panel.

Typical Amazon review is:

"A very engrossing book with historical importance, it keeps you guessing until the end."


"I bought two copies of this book. I find that the first copy perfectly predicts what the numbers will be in the second copy. I feel cheated."

You can read more at Amazon and find out the name of the people daft enough to leave honest reviews and so break Amazon's track record.

Interestingly the second quoted comment hits the nail on the head with what people tend to find disturbing about a book of randomness. How can it be random when it is repeatable?

Well random number generators in programming languages, and Excel in this case, are just the same. They are not random number generators at all, but pseudo random number generators. All that matters is that the next number should not be easy to predict given the current number and that all numbers occur equally often, all pairs occur equally often, and so on.

You could say that all that matters is that the numbers aren't predictable but what is predictable depends on how much effort you are prepared to put into the task.

So we come to the Canadian lottry:

Canada’s family-reunification program is using a common spreadsheet application to select candidates as part of a process critics say is flawed and open to manipulation.

Later we learn that the critics are "experts" and indeed they seem to be. The headline is:

Anything would be better:’ Critics warn Ottawa’s family-reunification lottery is flawed, open to manipulation

The spreadsheet algorithm used is:

  1. Enter each applicant one to a row.
  2. Use Rand to generate a column of pseudo random numbers
  3. Sort the spreadsheet based on the random numbers
  4. Take the top 10,000 rows as the randomly selected applicants.

Is this a fair procedure?

To be honest it would take a little more information to say for definite. For example, it is important to know if the applicants are entered in any particular order and who has control of the seed for the random number generator, or is the seed selected from a source of entropy.

The reported complaint is:

Excel’s method for generating random numbers is “very bad,” according to Université de Montréal computer-science professor Pierre L’Ecuyer, an expert in random-number generation. “It’s a very old generator, and it’s really not state-of-the-art.” Prof. L’Ecuyer’s research has shown that Excel’s random-number generator doesn’t pass certain statistical tests, meaning it’s less random than it appears. Under the current system, “it may be that not everybody has exactly the same chance,” Prof. L’Ecuyer said.

True enough, but it probably doesn't matter because the numbers are most likely random enough for the job.

Could someone make use of the regularities in the generator to "fix" the results? According to the report they probably could:

These generators have a key flaw – they rely on a “seed” number to kick off the mathematical process. In the case of Excel, this seed is generated automatically by the application. “If you know one number at one step,” Prof. L’Ecuyer explained, “you can compute all the numbers that will follow.”

However, there are almost certainly easier and less technical ways of cheating the system - like copy and pasting names from one row to another.

This isn't an example of fake news it's more like fake over-concern or a deliberate misunderstanding for political purposes. The body responsible stated:

“We stand by this randomized selection process as a sufficient means of equal opportunity for all who look to express an interest in sponsoring their parents and grandparents,” a spokesperson for IRCC said.

Ah well they would say that, wouldn't they... But in this case they are probably correct.

This is not to say that you should just use any random number generator that is offered to you, but it is important to judge it in context by asking, are the numbers random enough for the purpose?




More Information

Related Articles

Random Means Random - The Green Card Fiasco

The Monte Carlo method

How not to shuffle - the Knuth Fisher-Yates algorithm

ERNIE - A Random Number Generator       

Randomness Restored In Chrome 49


To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.




GitHub Introduces Code Scanning

GitHub has announced a public beta of a code scanner that automatically fixes problems. The new feature was announced back in November, but has now moved to public beta status.  

AWS Introduces A New JavaScript Runtime For Lambda

Amazon has announced the availability, albeit for experimental purposes, of a new JavaScript based runtime called Low Latency Runtime or LLRT for short, to bring JavaScript up to the performance throu [ ... ]

More News


raspberry pi books



or email your comment to:


Last Updated ( Sunday, 17 June 2018 )