Browse Source

Make random_choice applicable to set and dict as well

Yentl Van Tendeloo 9 years ago
parent
commit
82dcee0cae
1 changed files with 1 additions and 1 deletions
  1. 1 1
      bootstrap/random.alc

+ 1 - 1
bootstrap/random.alc

@@ -21,4 +21,4 @@ Integer function random_interval(a : Integer, b : Integer):
 	return cast_f2i(rand * (b - a) + a)
 
 Element function random_choice(list : Element):
-	return list_read(random_interval(0, list_len(list) - 1))
+	return read_edge_dst(read_out(list, random_interval(0, read_nr_out(list) - 1)))