Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

random with probability python

import random

data = [1, 2, 3, 4, 5, 6]
probability = [0.3, 0.3, 0.1, 0.1, 0.1, 0.1]
 
random.choices(data, probability)
Comment

PREVIOUS NEXT
Code Example
Python :: how to empty a text file in python 
Python :: sorted python lambda 
Python :: object.image.url email template django 
Python :: how to do swapping in python without sort function 
Python :: remove all of same value python list 
Python :: remove characters in array of string python 
Python :: install django windows 
Python :: arabic in python 
Python :: how to remove python3 on mac 
Python :: flask return html 
Python :: python every other including first 
Python :: python poner en mayusculas 
Python :: python little endian to big endian 
Python :: python delete the last line of console 
Python :: flask migrate install 
Python :: convert series to datetime 
Python :: opencv save image rgb 
Python :: pythondatetime cheatsheet 
Python :: python number guessing game 
Python :: how to change the title of a tkinter widnow 
Python :: python pandas cumulative sum of column 
Python :: chi square test in python 
Python :: read_csv Unnamed: 0 
Python :: how to make square shape python 
Python :: where my python modules 
Python :: python current utc offset 
Python :: forbidden (csrf cookie not set.) django rest framework 
Python :: random word py 
Python :: replace value column by another if missing pandas 
Python :: generate all parameters combination python 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =