Skip to content

Commit

Permalink
kconfig: use C89 random functions in conf.c
Browse files Browse the repository at this point in the history
rand and srand functions conform also to C89 in addition to POSIX.1-2001,
which makes them a bit more portable (work also on MinGW host). Linux man
page also says:
"The versions of rand() and srand() in the Linux C Library use the same
random number generator as random() and srandom()".

* Use C89 conformant functions rand() and srand()

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
  • Loading branch information
Ladislav Michl authored and Sam Ravnborg committed Jan 28, 2008
1 parent 75ff430 commit 07f7668
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/kconfig/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ static int conf_choice(struct menu *menu)
break;
case set_random:
if (is_new)
def = (random() % cnt) + 1;
def = (rand() % cnt) + 1;
case set_default:
case set_yes:
case set_mod:
Expand Down Expand Up @@ -526,7 +526,7 @@ int main(int ac, char **av)
break;
case 'r':
input_mode = set_random;
srandom(time(NULL));
srand(time(NULL));
break;
case 'h':
printf("See README for usage info\n");
Expand Down

0 comments on commit 07f7668

Please sign in to comment.