summaryrefslogtreecommitdiff
path: root/ubi-utils/src/ubiformat.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-09-28 11:50:51 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-09-28 11:50:51 +0300
commit75d97ca45b74eccc01b18f44040f946d9d5df9f5 (patch)
tree09f65340037347155934eda7ac2123cc0614915a /ubi-utils/src/ubiformat.c
parent0e63a4c4f1ebc31f545835bd018174414928fc6f (diff)
ubinize/ubiformat: improve random number seeding
Add current time to the PID to improve the pseudo-random number generator seeding. Also, use 'rand()' instead of 'random()', because 'srand()' is for 'rand()'. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils/src/ubiformat.c')
-rw-r--r--ubi-utils/src/ubiformat.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/ubi-utils/src/ubiformat.c b/ubi-utils/src/ubiformat.c
index 54363d7..62375a6 100644
--- a/ubi-utils/src/ubiformat.c
+++ b/ubi-utils/src/ubiformat.c
@@ -29,7 +29,6 @@
*/
#define MAX_CONSECUTIVE_BAD_BLOCKS 4
-#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdint.h>
@@ -130,8 +129,8 @@ static const struct option long_options[] = {
static int parse_opt(int argc, char * const argv[])
{
- srand(getpid());
- args.image_seq = random();
+ ubiutils_srand();
+ args.image_seq = rand();
while (1) {
int key;