Преглед изворни кода

Make random_choice applicable to set and dict as well

Yentl Van Tendeloo пре 9 година
родитељ
комит
82dcee0cae
1 измењених фајлова са 1 додато и 1 уклоњено
  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)))