vendredi 21 juin 2019

create list with random values --> duplicates allowed [duplicate]

This question already has an answer here:

Please show me a solution that EXACLY answeres my question. If you show me a stackoverflow answered question that is 100% the solution of my question --> I will delete my question

need to create list with random int values like [1,2,3,4,3,2,5,6,7,4,..]. Duplicates are allowed!!!! All solution I found are

  1. creating lists with uniques
  2. using list comprehention..

There should be something like : list_randoms = random.sample(range(1, 10), 9) --> this creates list of uniqes.

Also listcomprehention/numpy/etc should not be the solution.

There should be a python build-in function for that which I cannot find now.

Not answered as I expect:

How do I generate a random list in Python with duplicates numbers

Generate Random List of Random Numbers with Duplicates in Python 3.4

Python: Random numbers into a list




Aucun commentaire:

Enregistrer un commentaire