This morning I couldn’t sleep, so I remembered something interesting, computer generated random numbers are not really random numbers, or not strictly speaking.

But first, let’s talk about Deterministic Systems versus Stochastic Systems.

In mathematics, computer science and physics, a deterministic system is a system in which no randomness is involved in the development of future states of the system. A deterministic model will thus always produce the same output from a given starting condition or initial state.

So how does this affect or why do I say that computer generated random numbers are not strictly random?…

If you want to generate a “random” number using a computer and JavaScript, you can use `Math.random()` function that returns a floating-point number in the range 0 to less than 1 (inclusive of 0, but not 1).

``````0.3111280542759336
0.25985434139900176
0.3802321554535415``````

JavaScript always uses the same algorithm with the same seeds. The algorithm follows every time the same pattern to generate those numbers. And then you could think, could you guess the next random number? My answer is: No. The pattern is complex enough to identify it. So, that’s why we usually call them: Pseudo-random numbers.

How can we generate true random numbers? using quantum mechanics. How? make measurements on something that behaves randomly and from there we can extract random numbers.

But, why is this important? Because we are software developers (some of us, I guess), and we don’t want our applications to be hacked.

As Steve Ward (Professor of Computer Science and Engineering at MIT’s Computer Science and Artificial Intelligence Laboratory) says:

Truly random numbers make such reverse engineering impossible

This is only a brief introduction and gentle, the topic is much more complex than it seems. Especially when we introduce ourselves a little more to the world of cryptography.
{"ft_lang_label":"__label__en","ft_lang_prob":0.87177503,"math_prob":0.9191662,"size":2245,"snap":"2023-14-2023-23","text_gpt3_token_len":454,"char_repetition_ratio":0.14190094,"word_repetition_ratio":0.011396011,"special_character_ratio":0.21202673,"punctuation_ratio":0.11594203,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9553377,"pos_list":[0,1,2],"im_url_duplicate_count":[null,2,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-03-25T01:50:41Z\",\"WARC-Record-ID\":\"<urn:uuid:4b2aaea1-ebb1-4d34-af25-722fc70d72a5>\",\"Content-Length\":\"9688\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:55ee3108-c6a9-4adb-82ef-bc871b46b5b5>\",\"WARC-Concurrent-To\":\"<urn:uuid:91232e83-9906-436b-931e-0b96659799de>\",\"WARC-IP-Address\":\"76.76.21.93\",\"WARC-Target-URI\":\"https://www.velocidadescape.com/cs/computer-generated-random-numbers/\",\"WARC-Payload-Digest\":\"sha1:DLVHFZPQMIVMXDUMFAURMA4D6FTGN3J6\",\"WARC-Block-Digest\":\"sha1:UBCRAQXATX5CN6YYYOKG6Y3RU5WPPFUZ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-14/CC-MAIN-2023-14_segments_1679296945292.83_warc_CC-MAIN-20230325002113-20230325032113-00555.warc.gz\"}"}