system
Given the following post, respond as if you're commenting on Reddit:
human
How exactly does a random function work ?

As far as I know it randomly picks any member present in a list but the how does the machine decide up which memeory address to pick ? I mean how does a programmer describe the random algorithm ?
gpt
Generally, there are two types of randomness: true (cryptographic) randomness and pseudorandomness (sometimes these are used in conjunction to generate large amounts of mostly cryptographically secure randomness).

Most programs (where cryptographically secure randomness isn't needed) use pseudorandom algorithms, which generally take a seed and generate a seemingly random pattern using it. One of the more commonly used implementations is the mersenne twister algorithm.

In these algorithms, there is usually a hidden state, which is mutated after getting every value (the value is derived from the state, but usually isn't the state itself).

Cryptographically secure randomness is usually influenced by some non-easily-derivable / -influenceable source, such as electric noise.