kconfig: make randconfig fair for booleans
authorPeter Korsgaard <jacmet@sunsite.dk>
Thu, 22 Jul 2010 12:24:57 +0000 (14:24 +0200)
committerMichal Marek <mmarek@suse.cz>
Mon, 26 Jul 2010 13:40:52 +0000 (15:40 +0200)
Give boolean symbols a 50% chance of getting enabled, rather than 67%.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
scripts/kconfig/confdata.c

index c4dec80cfd8e14a94792af807da0e9705256257d..210a49e27d4702869f1d98316051db758627ab99 100644 (file)
@@ -862,7 +862,8 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
                                sym->def[S_DEF_USER].tri = no;
                                break;
                        case def_random:
-                               sym->def[S_DEF_USER].tri = (tristate)(rand() % 3);
+                               cnt = sym_get_type(sym) == S_TRISTATE ? 3 : 2;
+                               sym->def[S_DEF_USER].tri = (tristate)(rand() % cnt);
                                break;
                        default:
                                continue;