Post Reply 
Randomize a List problem
09-15-2020, 07:53 PM
Post: #14
RE: Randomize a List problem
(09-15-2020 03:57 PM)Hlib Wrote:  I inserted a fragment into the source program, which swaps 1-st and random n-th elements on stack ...

Do not use this code ! This is much worse than "random(t) ROLLD"
Code:
Starting pattern = 123, shuffled pattern has 3^3 = 27 ways

Pattern swap 1st random(t) ROLLD
123     7        5
132     2        4        
213     6        5
231     3        5
312     3        4
321     6        4

Uneven probabilities problem get worse with more items in the list.
This is not just pigeonhole issues anymore.

I would recommend not cutting corners here, and use good shuffling code.

Code:
Starting pattern = 1234, shuffled pattern has 4^4 = 256 ways

Pattern swap 1st random(t) ROLLD
1234    34       15
1243    8        7
1324    8        14
1342    3        14
1423    3        7
1432    8        7
2134    24       15
2143    4        7
2314    14       15
2341    4        15
2413    4        7
2431    14       7
3124    14       14
3142    4        14
3214    24       14
3241    14       14
3412    4        14
3421    4        14
4123    4        7
4132    14       7
4213    14       7
4231    24       7
4312    4        7
4321    4        7
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Randomize a List problem - Hlib - 09-14-2020, 04:38 PM
RE: Randomize a List problem - John Keith - 09-14-2020, 06:08 PM
RE: Randomize a List problem - Albert Chan - 09-14-2020, 07:32 PM
RE: Randomize a List problem - Hlib - 09-14-2020, 08:51 PM
RE: Randomize a List problem - Albert Chan - 09-14-2020, 11:41 PM
RE: Randomize a List problem - Werner - 09-15-2020, 06:41 AM
RE: Randomize a List problem - Werner - 09-15-2020, 09:47 AM
RE: Randomize a List problem - Albert Chan - 09-15-2020, 04:36 PM
RE: Randomize a List problem - ijabbott - 09-15-2020, 06:39 PM
RE: Randomize a List problem - John Keith - 09-15-2020, 08:56 PM
RE: Randomize a List problem - Albert Chan - 09-15-2020, 09:34 PM
RE: Randomize a List problem - Werner - 09-16-2020, 06:43 AM
RE: Randomize a List problem - John Keith - 09-16-2020, 11:51 AM
RE: Randomize a List problem - Albert Chan - 09-15-2020, 01:00 AM
RE: Randomize a List problem - Wes Loewer - 09-15-2020, 04:10 AM
RE: Randomize a List problem - John Keith - 09-15-2020, 01:42 PM
RE: Randomize a List problem - Hlib - 09-15-2020, 03:57 PM
RE: Randomize a List problem - Albert Chan - 09-15-2020 07:53 PM
RE: Randomize a List problem - Albert Chan - 09-17-2020, 12:11 PM
RE: Randomize a List problem - Hlib - 09-17-2020, 09:36 AM
RE: Randomize a List problem - John Keith - 09-17-2020, 12:20 PM
RE: Randomize a List problem - Albert Chan - 09-17-2020, 01:42 PM
RE: Randomize a List problem - John Keith - 09-17-2020, 08:21 PM
RE: Randomize a List problem - John Keith - 09-18-2020, 03:31 PM
RE: Randomize a List problem - Albert Chan - 09-18-2020, 10:19 PM
RE: Randomize a List problem - Albert Chan - 09-19-2020, 12:29 AM
RE: Randomize a List problem - pier4r - 10-13-2020, 07:13 PM
RE: Randomize a List problem - DavidM - 10-14-2020, 04:12 AM
RE: Randomize a List problem - Albert Chan - 10-15-2020, 04:43 PM
RE: Randomize a List problem - DavidM - 10-15-2020, 06:24 PM
RE: Randomize a List problem - pier4r - 10-14-2020, 06:55 PM
RE: Randomize a List problem - DavidM - 04-26-2024, 03:17 PM



User(s) browsing this thread: 1 Guest(s)