# -*- coding: utf-8 -*-
"""
Created on Sat Oct  3 19:12:56 2026

@author: 3dsam
"""

import numpy as np
from matplotlib import pyplot as plt
plt.rc('text', usetex=True)

fig, axs = plt.subplots(2, 3,figsize=(15,9), constrained_layout=True)


for ax in axs.flat:
    ax.set(xlabel='x-label', ylabel='y-label')






Ns = [2,3,4,10,100,1000]
k,l = 0,0

for N in Ns:
    n = 6*N-(N-1)
    
    H = []
    M = 500000
    for i in range(0,M):
        S = np.random.rand(N) * 6.
        L = np.ceil(S)
        #print(L)
        H.append(np.sum(L))
        
    saw = []
    nsaw = []
    for i in range(0,len(H)):
        if H[i] in saw:
            a = saw.index(H[i])
            nsaw[a] += 1
        else:
            saw.append(H[i])
            nsaw.append(1)
            
    pairs = sorted(zip(saw, nsaw))
    saw, nsaw = zip(*pairs)
    
    saw = list(saw)
    nsaw = list(nsaw)
    axs[k,l].set_title(f"{N} dices")
    axs[k,l].set(xlabel=r'$\Sigma$', ylabel='count')
    axs[k,l].plot(np.array(saw), nsaw)
    l = l+1
    if l > 2:
        l=0
        k=k+1
        