mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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:
parent
8926814468
commit
824bac37ed
@ -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];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user