List randomizer


Write lines:




Random order:







import asyncio import random import pyodide async def pause(secs): await asyncio.sleep(secs) async def ransomize(*ags, **kws): lstRandom = str(Element('textarea1').element.value).splitlines() random.shuffle(lstRandom) buff = "" for i, item in enumerate(lstRandom): buff = item.strip() + "\n" + buff if i < len(lstRandom) - 10: await pause(0.001) else: await pause(0.9) pyscript.write('textarea2', buff) pyscript.write('rearrange', len(lstRandom) - i) pyscript.write('rearrange', "Do again!") btnElem = js.document.getElementById('rearrange') btnElem.addEventListener('click', pyodide.ffi.create_proxy(ransomize))