30/09/2018, 18:18

Xin hỏi Cơ chế tạo số ngẫu nhiên trong C++ như thế nào?

trong các câu phỏng vấn họ có hỏi Cơ chế tạo số ngẫu nhiên trong C++ như thế nào ?

theo mình trả lời thì nó lấy ngẫu nhiêu trong ram và cấp phát ra nhưng câu trả lời này không hoàn toàn chính xác

Mai Anh Dũng viết 20:21 ngày 30/09/2018

Nếu nói về cơ chế thì Đạt google được cái này

en.wikipedia.org

Linear congruential generator

A linear congruential generator (LCG) is an algorithm that yields a sequence of pseudo–randomized numbers calculated with a discontinuous piecewise linear equation. The method represents one of the oldest and best–known pseudorandom number generator algorithms. The theory behind them is relatively easy to understand, and they are easily implemented and fast, especially on computer hardware which can provide modulo arithmetic by storage–bit truncation. The generator is defined by recurrence re...

Bài liên quan
0