replace insane algorithm (which always returned last iterm in array)

with something real.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@10236 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 2004-08-27 21:37:20 +00:00
parent 8926814468
commit 824bac37ed

View File

@ -323,20 +323,9 @@ get_random_string_in_array(const char* str_list[])
int num;
const char *to_ret = NULL;
for(num = 0; str_list[num] != NULL; num++)
{
switch(get_random_int_in_range(0, num + 1))
{
case 0:
to_ret = str_list[num];
default:
if(str_list[num + 1] == NULL)
{
return to_ret;
}
to_ret = str_list[num + 1];
}
}
return to_ret;
/* count number of items in list */
for(num = 0; str_list[num] != NULL; num++);
num = get_random_int_in_range(0, num-1);
return str_list[num];
}