Electronics ru
Advanced Search +
Go Back   RadioLocman Forum > Electronics and ... > Beginners

Beginners Questions from beginners.

Thread Tools Search this Thread
Old 05-18-2016, 05:55 PM   #1
Junior Member
Join Date: Feb 2016
Posts: 18
Em_13 is on a distinguished road
Default What value for srand()?

Hello everyone,

I am trying to find what of value that i can give to srand() so that there isn't still the same pattern if don't do that and only use the rand() than when i start i begin always with 127 , 280 , 300 , .... and after a reset it is still the same pattern.

Does anyone have any suggestion?

The microcontroller that i use is an STM32F091 nucleo.
Em_13 is offline   Reply With Quote
Old 05-26-2016, 06:52 PM   #2
Join Date: Nov 2013
Posts: 53
hemilton is on a distinguished road

The srand() function requires be feed by a seed number, prefereably assynchronous with the microprocessor's clock, such as for example getting the instantaneous value of an endless counter at the exact moment when a button is pressed.
hemilton is offline   Reply With Quote
Old 07-05-2017, 04:59 AM   #3
Mohammed al-Fassi
Junior Member
Join Date: Jul 2017
Posts: 5
Mohammed al-Fassi is on a distinguished road

The srand() function sets the starting point for producing a series of pseudo-random integers. If srand() is not called, the rand() seed is set as if srand(1) were called at program start. Any other value for seed sets the generator to a different starting point.
The rand() function generates the pseudo-random numbers.
Mohammed al-Fassi is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the value of this capacitor' mark Beginners 1 03-10-2016 03:22 PM
ADC using DMA in STM32F105, zero value alibarghi Microcontrollers (MCU) 0 01-09-2016 03:54 PM
What is the basic software for designing Schematic and PCB's Jon Beginners 1 07-26-2015 11:35 AM
What environment is better to program STM controller ? maks Microcontrollers (MCU) 1 05-29-2015 11:32 AM

All times are GMT. The time now is 06:14 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Slices ↓
Radiolocman facebook Radiolocman twitter Radiolocman google plus