Get Random Element(s) from a List

后端 未结 0 1140
野趣味
野趣味 2021-02-11 16:54

I\'m basically looking for an Elixir equivalent of Ruby\'s Array#sample. Something that would let me do this:

list = [1,2,3,4,5,6,7]

sample(list)
#=> 4

samp         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题