This site works best with JavaScript enabled!

Description: Random generator - Random Order

Random Generator Order

In this article the algorithm of the generator "Random Order" is described. You can enter several names into the random generator which will then be arranged in a random order. For example, you can select which entry of your TODO list should be done first.

Random generator "Random Order"

Click here to go to the random generator described below.

What is randomness?

Randomness is an event for which there is no causal explanation. This means that the result of a random generator may not be predictable or computable. This, however, contradicts the laws of each computer. In other words, a computer can not produce absolutely random numbers without additional peripherals. In this case we call it pseudo-random numbers. In general, you can philosophize about at which point you can actually speak about randomness.

How are the names arranged randomly?

Theoretically, three different mechanisms for generating pseudo-random numbers are used in this generator, but two of them are only used to generate the binary string in the background.

Random generator 1 and 2 for binary string

How these random generators work, is explained here in detail.

Random generator 3 for random order

The previous random number generators produce relatively good random numbers, which, however, can further be improved. The random order is therefore always generated on server-side with the PHP function random_int(), which generates cryptographically secure pseudo-random numbers:

1
2
3
4
5
6
7
8
9
10
11
// The array $names contains all names

// Select all names
for($i = 1; $i <= $number_all_names; $i++) {
	
	$index 			= random_int(0, count($names)-1);
	$random_order[] 	= $names[$index];
	unset($names[$index]);				// Delete entry
	$names 			= array_values($names);	// Reset indexes
	
}
Share this page
Posted on 15.01.2018 | Last modified on 16.01.2018