Explorar o código

Make random_choice applicable to set and dict as well

Yentl Van Tendeloo %!s(int64=9) %!d(string=hai) anos
pai
achega
82dcee0cae
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  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)))