cancel
Showing results for 
Search instead for 
Did you mean: 

How I can generate random number?

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

How I can generate random number?

2 REPLIES 2
ciccio
Associate II
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
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.