kconfig: make rand{,package}config fair
authorPeter Korsgaard <jacmet@sunsite.dk>
Thu, 22 Jul 2010 12:16:42 +0000 (14:16 +0200)
committerPeter Korsgaard <jacmet@sunsite.dk>
Thu, 22 Jul 2010 12:17:51 +0000 (14:17 +0200)
Give each boolean symbol a 50% chance of getting enabled, rather than 67%.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
package/config/confdata.c

index 51a3d9a6f594543bf52445a0ffab4a39497a87ec..728f708ca20f66e3996a1f0467ee671619442053 100644 (file)
@@ -864,7 +864,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;