Discord
Login
Community
DARK THEME

Random function with list

How to use random function so that it chooses a random item from a list?

  list = [ "abc", 1 , 123, "xyz" ]
  print( list[ random.nextInt( list.length )] )

thank you @Loginus

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community