C語言中的隨機(jī)函數(shù)
本文檔由 kge1 分享于2010-12-18 13:28
1 rand 與srand 在C語言函數(shù)庫中包含了一個(gè)產(chǎn)生隨機(jī)數(shù)的函數(shù):int rand void ;在函數(shù)庫中對(duì)這個(gè)函數(shù)的說明是:The rand function returns apseudorandom integer in the range 0to RAND MAX Use the srand function to seed the pseudorandom number generator before calling rand 而在C語言函數(shù)庫中是這樣定義RAND MAX的: Maximum value returned by rand function define RAND MAX 0x7FFF所以,函數(shù)in..