Как сделать чтобы рандом не повторялся в телеграм боте?

import random
import telebot
bot = telebot.TeleBot("....")

Допустим есть функция

def random_text():
 array = ['Some text-1','Some text-2','Some text-3']
 return str( random.choice(array) )

Допустим есть бот

@bot.message_handler(content_types=['text'])
def reaction(message):
  if message.chat.type == 'private':
     if message.text == 'Something':
        bot.send_message(message.from_user.id, random_text())

Я пробовал сделать как-то так:

def random_text():
 array = ['Some text-1','Some text-2','Some text-3']
 choice = random.choice(array)
 array.remove(choice)
 return str(choice)

Но оно не работает.И если можно, то как обновить список после перечисления всех его элементов?


Ответы (0 шт):