提交 07f76688 编写于 作者: L Ladislav Michl 提交者: Sam Ravnborg

kconfig: use C89 random functions in conf.c

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: NLadislav Michl <ladis@linux-mips.org>
Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
上级 75ff4309
...@@ -375,7 +375,7 @@ static int conf_choice(struct menu *menu) ...@@ -375,7 +375,7 @@ static int conf_choice(struct menu *menu)
break; break;
case set_random: case set_random:
if (is_new) if (is_new)
def = (random() % cnt) + 1; def = (rand() % cnt) + 1;
case set_default: case set_default:
case set_yes: case set_yes:
case set_mod: case set_mod:
...@@ -526,7 +526,7 @@ int main(int ac, char **av) ...@@ -526,7 +526,7 @@ int main(int ac, char **av)
break; break;
case 'r': case 'r':
input_mode = set_random; input_mode = set_random;
srandom(time(NULL)); srand(time(NULL));
break; break;
case 'h': case 'h':
printf("See README for usage info\n"); printf("See README for usage info\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册