ZKMC [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=36069 Custom random string function returns the same randomized string <p>When setting 2 table elements to the same function it returns the same output, I am trying to figure out how to &quot;refresh&quot; the function so it will generate a new random string each time I need to set a variable to that function. Provide below is said code; hopefully the comments make sense. Thanks In advance.</p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>idtable={&quot;aaaaaa&quot;,&quot;aaaaaa&quot;} id=&quot;&quot; i=0 x=0 function idgen() if i!= 3 then --i loop to generate 3 random numbers x=flr(rnd(16)) --picks a number between 0-15 if (x&lt;10) then --ensures single digits have 0 appended to the front to maintain fixed string length id=id..&quot;0&quot;..x else id=id..x end i+=1 end return id end function _update() end function _draw() cls() idtable[1]=idgen(id) idtable[2]=idgen(id) --doesn't generate new random string print(idtable[1],0,0,7) print(idtable[2],0,8,7) end</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> https://www.lexaloffle.com/bbs/?tid=33698 https://www.lexaloffle.com/bbs/?tid=33698 Sat, 23 Mar 2019 08:11:20 UTC