RE: graded randomness

2018-12-28 Thread Avi Gross
partition. Not to repeat, there are many other ways so feel free to innovate. -Original Message- From: Python-list On Behalf Of Abdur-Rahmaan Janhangeer Sent: Friday, December 28, 2018 2:45 PM To: Python Subject: Re: graded randomness well i wanted that to improve the following code: h

Re: graded randomness

2018-12-28 Thread Abdur-Rahmaan Janhangeer
well i wanted that to improve the following code: https://www.pythonmembers.club/2018/12/28/reviving-bertrand-russell-through-python/ that one i used the random list technique Abdur-Rahmaan Janhangeer http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ Mauritius > -- https://mail

Re: graded randomness

2018-12-28 Thread Abdur-Rahmaan Janhangeer
woops @ben me too i got that solution but i'm searching for a neater answer. let us say i'm using it over new data, 1 million data of red blue green can be saved by just dealing with the probabilities ^^_ Abdur-Rahmaan Janhangeer http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ M

Re: graded randomness

2018-12-28 Thread Tim Chase
On 2018-12-28 17:31, Abdur-Rahmaan Janhangeer wrote: > do you have something like > > choice(balls) > > >>> red Don't specify the "k=" (which defaults to 1 if you omit it) and use the first element of the results: >>> from random import choices >>> distribution = {"green":2, "red": 2, "blue":

Re: graded randomness

2018-12-28 Thread Tim Chase
On 2018-12-28 16:15, Abdur-Rahmaan Janhangeer wrote: > greetings, > > let us say that i have a box of 5 balls, > > green balls - 2 with probability 2/5 > red balls 2 - with probability 2/5 > blue balls 1 - with probability 1/5 > > how to program the selection so that the random choices reflect t

Re: graded randomness

2018-12-28 Thread Abdur-Rahmaan Janhangeer
ah yes, powerful enough for further customisations * scratches head thanks everybody ! Abdur-Rahmaan Janhangeer http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ Mauritius -- https://mail.python.org/mailman/listinfo/python-list

Re: graded randomness

2018-12-28 Thread Chris Angelico
On Sat, Dec 29, 2018 at 12:28 AM Abdur-Rahmaan Janhangeer wrote: > > woops @ben me too i got that solution but i'm searching for a neater answer. > > let us say i'm using it over new data, 1 million data of red blue green can > be saved by just dealing with the probabilities ^^_ Assuming you're o

Re: graded randomness

2018-12-28 Thread Abdur-Rahmaan Janhangeer
@Tim do you have something like choice(balls) >>> red and subsequent repetitions for long enough yield approximately 2/5 times r 2/5 times g and 1/5 b like one without random choice over list/tuples Abdur-Rahmaan Janhangeer http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ Mau

Re: graded randomness

2018-12-28 Thread Ben Bacarisse
Abdur-Rahmaan Janhangeer writes: > let us say that i have a box of 5 balls, > > green balls - 2 with probability 2/5 > red balls 2 - with probability 2/5 > blue balls 1 - with probability 1/5 > > how to program the selection so that the random choices reflect the > probabilities? >>> import rand

graded randomness

2018-12-28 Thread Abdur-Rahmaan Janhangeer
greetings, let us say that i have a box of 5 balls, green balls - 2 with probability 2/5 red balls 2 - with probability 2/5 blue balls 1 - with probability 1/5 how to program the selection so that the random choices reflect the probabilities? -- Abdur-Rahmaan Janhangeer http://www.pythonmember