Random numbers in different programming languages

If I use the random number generator function in different programming languages, and I selected the same seed. Should they give me the same random numbers?

for example, I used Java and Perl ... gave different numbers.

+2
source share
2 answers

Not if both languages ​​do not use the same algorithm.

+3
source

Portability between languages ​​is one of the reasons for using your own random number generator. This article provides a very small random number generator, the algorithm of which is tested by experts. You can easily transfer the generator to any language that supports basic operations with 32-bit unsigned integers. Each implementation should return the same sequence of outputs with the same seeds.

+5
source

Source: https://habr.com/ru/post/1215955/


All Articles