implementation of rand()

后端 未结 11 1462
遥遥无期
遥遥无期 2020-12-01 01:34

I am writing some embedded code in C and need to use the rand() function. Unfortunately, rand() is not supported in the library for the controller. I need a simple implement

11条回答
  •  日久生厌
    2020-12-01 02:28

    I recommend the academic paper Two Fast Implementations of the Minimal Standard Random Number Generator by David Carta. You can find free PDF through Google. The original paper on the Minimal Standard Random Number Generator is also worth reading.

    Carta's code gives fast, high-quality random numbers on 32-bit machines. For a more thorough evaluation, see the paper.

提交回复
热议问题