




let dom=$M.find('#_exec')

let maxLen=50


function insert(str)
{
    let len=dom.children.legth
    if(len>maxLen)$M.removeChild(dom.children[len-1])
    let span=document.createElement('span')
    span.innerHTML='> '+str+'<br/>'
    dom.insertBefore(span,dom.children[0])
}

function code(shoCode)
{
    $M.find('#_code').innerHTML=shoCode
    .replace(/\n/g,'<br/>')
    .replace(/\s/g,'&nbsp;')
    .replace(/\//g,'\/')
}
let globalTag
dom.rely
(
    'html','content-com-code-update',(event)=>
    {
        let param=event.detail
        let 代码=param.代码
        Reflect.deleteProperty(param,'代码')
        for (let key in param) 
        {
            let cur=param[key]
            if(!cur.length)continue
            switch (key) 
            {
                case 'seed':
                    key='线性同余'
                break;
                case 'rand':
                    key='自带随机'
                break;
                case 'sho':
                    key='正太分布'
                break;
            }
            insert(key+'->'+JSON.stringify(cur))
        }
        insert('--------------------')
        if(!globalTag)code(代码)

        globalTag=true
    }
)