Machine-translated by Google. Questions are authored in English.
Top

Discussion

Bitwise can be used to generate a random number.

  • A.Yes
  • B.No

Answer: B

Correct answer: No

Bitwise operators are entirely deterministic: the same operands always give the same result, so nothing about them produces randomness.

A pseudo-random generator needs persistent state, a seed and an algorithm chosen so that successive outputs pass statistical tests. Some well-known generators - the xorshift family - are indeed built from XOR and shifts, but the randomness comes from the algorithm and the seed, not from the operators, which are only the arithmetic it happens to use.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.