Skip to main content
ciccio
Associate II
July 23, 2008
Question

How I can generate random number?

  • July 23, 2008
  • 2 replies
  • 1838 views
Posted on July 23, 2008 at 20:05

How I can generate random number?

This topic has been closed for replies.

2 replies

ciccio
ciccioAuthor
Associate II
July 23, 2008
Posted on July 23, 2008 at 20:05

Hi,

there are some libraries for generate random integer?

Now I have used srand() and rand() of Hiware.

srand() setting start value.

rand() generate random integer binded of start value.

star value = ADC1 + ADC2

ADC1= humidity sensor

ADC2= temperature sensor

This not very good algorithm :-[

Other solution? Thanks

I use ST325K6.

Bye

harry_rostovtsev
Associate II
December 16, 2013
Posted on December 16, 2013 at 06:14

I posted this to another thread about random numbers but since you're looking:

This code uses hardware on the stm32f103 to generate true random numbers without having to add any new hardware: http://www.gniibe.org/memo/development/gnuk/rng/pqrng

You probably can't use this directly but should be pretty easy to modify for your needs.