Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Random Lotto number generator! (V2)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> LUA Tutorials
View previous topic :: View next topic  
Author Message
AylinCE
Grandmaster Cheater Supreme
Reputation: 33

Joined: 16 Feb 2017
Posts: 1330

PostPosted: Sun Apr 28, 2024 1:40 pm    Post subject: Random Lotto number generator! (V2) Reply with quote

Use it to generate random numbers in games of chance, such as the lottery, and to ensure that these numbers consist of samples that do not repeat the same numbers for each column and cou _ pon.

Note: If you win with the numbers generated by this tool, buy me a coffee via Paypal. Shocked Smile
Paypal: https://fuck.me/49YrxZy


Number Range: Write how many digits are in a column in the boxes. (min - max)

'+' Range (if any): In some cases, there are game types with + option. (Such as 5+1, 10+1.)
Write the numbers designated for plus in the boxes. (min - max) and make sure you check the "Confirm" box for it to take effect.
res: 14 19 20 28 31 + 7

How Many: How many numbers are marked in a column? Specify it here.

Columns: If everything is OK, specify how many columns (Samples) you want it to produce in the given parameters.

Start: Start production and wait. The results will be printed in the list.

Print List: Allows you to print the results in the list to a .txt file in the same directory as Trainer.
Note that every time you click this button it will create a new file.
Try to print the final results.
(txt file name: Lotto_(current time parameter))

Clear List: Clears the list!

What's new in V2:
Added a box below the list.
It filters the list for a single column and shows the most repeated numbers.

Below is an example image;



Code:
if sfrm1 then sfrm1.Destroy() sfrm1=nil end
DP1=getScreenDPI()/96
sfrm1=createForm()
sfrm1.height=540*DP1 sfrm1.width=340*DP1
sfrm1.PopupMode=0 sfrm1.caption="By AylinCE  Trainers  (2024)"
sfrm1.Position="poDesktopCenter" sfrm1.ShowInTaskBar="stAlways"
sfrm1.BorderStyle="bsNone"
sfrm1.setLayeredAttributes(0x000100, 255, LWA_COLORKEY | LWA_ALPHA )
sfrm1.Color=0x000100
sfrm1.Visible=false
--############################################################################--
--############################################################################--
-------------------------
local lotto = {}
-------------------------
----------------------- lotto.spnl1 ----- 
lotto.spnl1=createPanel(sfrm1)
lotto.spnl1.AutoSize=false
lotto.spnl1.height=35*DP1 lotto.spnl1.width=320*DP1 lotto.spnl1.left=10*DP1 lotto.spnl1.top=0*DP1
lotto.spnl1.caption="Random Lotto Cou_pon Generator"
lotto.spnl1.Color=15963681 lotto.spnl1.BevelWidth=5 lotto.spnl1.Cursor = -22
lotto.spnl1.Font.Style="fsBold" lotto.spnl1.Font.Size=11*DP1
lotto.spnl1.OnMouseDown=function() sfrm1.DragNow() end
-----------------------
----------------------- lotto.smbtn1 ----- 
lotto.smbtn1=createButton(lotto.spnl1)
lotto.smbtn1.AutoSize=false
lotto.smbtn1.height=25*DP1 lotto.smbtn1.width=30*DP1 lotto.smbtn1.left=5*DP1 lotto.smbtn1.top=5*DP1
lotto.smbtn1.caption="--"
lotto.smbtn1.Font.Style="fsBold" lotto.smbtn1.Font.Size=14*DP1
-----------------------
----------------------- lotto.smbtn2 ----- 
lotto.smbtn2=createButton(lotto.spnl1)
lotto.smbtn2.AutoSize=false
lotto.smbtn2.height=25*DP1 lotto.smbtn2.width=30*DP1 lotto.smbtn2.left=285*DP1 lotto.smbtn2.top=5*DP1
lotto.smbtn2.caption="X"
lotto.smbtn2.Font.Style="fsBold" lotto.smbtn2.Font.Size=14*DP1
-----------------------
--############################################################################--
--############################################################################--
----------------------- lotto.spnl2 ----- 
lotto.spnl2=createPanel(sfrm1)
lotto.spnl2.AutoSize=false
lotto.spnl2.height=490*DP1 lotto.spnl2.width=320*DP1 lotto.spnl2.left=10*DP1 lotto.spnl2.top=40*DP1
lotto.spnl2.Color=15963681 lotto.spnl2.BevelWidth=5
lotto.spnl2.Font.Style="fsBold" lotto.spnl2.Font.Size=10*DP1
-----------------------
----------------------- lotto.slbl1 ----- 
lotto.slbl1=createLabel(lotto.spnl2)
lotto.slbl1.AutoSize=false
lotto.slbl1.height=24*DP1 lotto.slbl1.width=130*DP1 lotto.slbl1.left=10*DP1 lotto.slbl1.top=10*DP1
lotto.slbl1.caption="Number Range : "
lotto.slbl1.alignment="taRightJustify"
lotto.slbl1.Font.Style="fsBold" lotto.slbl1.Font.Size=10*DP1
lotto.slbl1.OptimalFill=true
-----------------------
----------------------- lotto.slbl2 ----- 
lotto.slbl2=createLabel(lotto.spnl2)
lotto.slbl2.AutoSize=false
lotto.slbl2.height=24*DP1 lotto.slbl2.width=130*DP1 lotto.slbl2.left=10*DP1 lotto.slbl2.top=40*DP1
lotto.slbl2.caption="'+' Range (if any) : "
lotto.slbl2.alignment="taRightJustify"
lotto.slbl2.Font.Style="fsBold" lotto.slbl2.Font.Size=10*DP1
lotto.slbl2.OptimalFill=true
-----------------------
----------------------- lotto.slbl3 ----- 
lotto.slbl3=createLabel(lotto.spnl2)
lotto.slbl3.AutoSize=false
lotto.slbl3.height=24*DP1 lotto.slbl3.width=130*DP1 lotto.slbl3.left=10*DP1 lotto.slbl3.top=70*DP1
lotto.slbl3.caption="How Many : "
lotto.slbl3.alignment="taRightJustify"
lotto.slbl3.Font.Style="fsBold" lotto.slbl3.Font.Size=10*DP1
lotto.slbl3.OptimalFill=true
-----------------------
----------------------- lotto.slbl4 ----- 
lotto.slbl4=createLabel(lotto.spnl2)
lotto.slbl4.AutoSize=false
lotto.slbl4.height=24*DP1 lotto.slbl4.width=130*DP1 lotto.slbl4.left=10*DP1 lotto.slbl4.top=100*DP1
lotto.slbl4.caption="Columns : "
lotto.slbl4.alignment="taRightJustify"
lotto.slbl4.Font.Style="fsBold" lotto.slbl4.Font.Size=10*DP1
lotto.slbl4.OptimalFill=true
-----------------------
----------------------- lotto.sedt1 ----- 
lotto.sedt1=createEdit(lotto.spnl2)
lotto.sedt1.AutoSize=false
lotto.sedt1.height=22*DP1 lotto.sedt1.width=40*DP1 lotto.sedt1.left=140*DP1 lotto.sedt1.top=8*DP1
lotto.sedt1.text="1"
lotto.sedt1.alignment="taLeftJustify"
lotto.sedt1.Font.Style="fsBold" lotto.sedt1.Font.Size=10*DP1
-----------------------
----------------------- lotto.sedt2 ----- 
lotto.sedt2=createEdit(lotto.spnl2)
lotto.sedt2.AutoSize=false
lotto.sedt2.height=22*DP1 lotto.sedt2.width=40*DP1 lotto.sedt2.left=190*DP1 lotto.sedt2.top=8*DP1
lotto.sedt2.text="34"
lotto.sedt2.alignment="taLeftJustify"
lotto.sedt2.Font.Style="fsBold" lotto.sedt2.Font.Size=10*DP1
-----------------------
----------------------- lotto.sedt3 ----- 
lotto.sedt3=createEdit(lotto.spnl2)
lotto.sedt3.AutoSize=false
lotto.sedt3.height=22*DP1 lotto.sedt3.width=40*DP1 lotto.sedt3.left=140*DP1 lotto.sedt3.top=40*DP1
lotto.sedt3.text="1"
lotto.sedt3.alignment="taLeftJustify"
lotto.sedt3.Font.Style="fsBold" lotto.sedt3.Font.Size=10*DP1
-----------------------
----------------------- lotto.sedt4 ----- 
lotto.sedt4=createEdit(lotto.spnl2)
lotto.sedt4.AutoSize=false
lotto.sedt4.height=22*DP1 lotto.sedt4.width=40*DP1 lotto.sedt4.left=190*DP1 lotto.sedt4.top=40*DP1
lotto.sedt4.text="13"
lotto.sedt4.alignment="taLeftJustify"
lotto.sedt4.Font.Style="fsBold" lotto.sedt4.Font.Size=10*DP1
-----------------------
----------------------- lotto.sedt5 ----- 
lotto.sedt5=createEdit(lotto.spnl2)
lotto.sedt5.AutoSize=false
lotto.sedt5.height=22*DP1 lotto.sedt5.width=40*DP1 lotto.sedt5.left=140*DP1 lotto.sedt5.top=70*DP1
lotto.sedt5.text="5"
lotto.sedt5.alignment="taLeftJustify"
lotto.sedt5.Font.Style="fsBold" lotto.sedt5.Font.Size=10*DP1
-----------------------
----------------------- lotto.sedt6 ----- 
lotto.sedt6=createEdit(lotto.spnl2)
lotto.sedt6.AutoSize=false
lotto.sedt6.height=22*DP1 lotto.sedt6.width=40*DP1 lotto.sedt6.left=140*DP1 lotto.sedt6.top=100*DP1
lotto.sedt6.text="30"
lotto.sedt6.alignment="taLeftJustify"
lotto.sedt6.Font.Style="fsBold" lotto.sedt6.Font.Size=10*DP1
-----------------------
----------------------- lotto.scbox ----- 
lotto.scbox=createCheckBox(lotto.spnl2)
lotto.scbox.AutoSize=true
lotto.scbox.height=21*DP1 lotto.scbox.width=70*DP1 lotto.scbox.left=235*DP1 lotto.scbox.top=40*DP1
lotto.scbox.caption="Confirm"
lotto.scbox.Cursor = -21
lotto.scbox.Font.Style="fsBold" lotto.scbox.Font.Size=10*DP1
-----------------------
----------------------- lotto.sbtn1 ----- 
lotto.sbtn1=createButton(lotto.spnl2)
lotto.sbtn1.AutoSize=false
lotto.sbtn1.height=25*DP1 lotto.sbtn1.width=139*DP1 lotto.sbtn1.left=92*DP1 lotto.sbtn1.top=135*DP1
lotto.sbtn1.caption="Start"
lotto.sbtn1.Font.Style="fsBold" lotto.sbtn1.Font.Size=10*DP1
-----------------------
----------------------- lotto.smemo1 ----- 
lotto.smemo1=createMemo(lotto.spnl2)
lotto.smemo1.AutoSize=false
lotto.smemo1.height=245*DP1 lotto.smemo1.width=300*DP1 lotto.smemo1.left=10*DP1 lotto.smemo1.top=170*DP1
lotto.smemo1.Color=5828351
lotto.smemo1.Font.Style="fsBold" lotto.smemo1.Font.Size=10*DP1
lotto.smemo1.ScrollBars="ssAutoBoth" lotto.smemo1.wordWrap=false
-----------------------
----------------------- lotto.slbl5 ----- 
lotto.slbl5=createLabel(lotto.spnl2)
lotto.slbl5.AutoSize=false
lotto.slbl5.height=24*DP1 lotto.slbl5.width=120*DP1 lotto.slbl5.left=186*DP1 lotto.slbl5.top=100*DP1
lotto.slbl5.caption="0  : Completed "
lotto.slbl5.alignment="taLeftJustify"
lotto.slbl5.Font.Style="fsBold" lotto.slbl5.Font.Size=10*DP1
lotto.slbl5.OptimalFill=true
-----------------------
----------------------- lotto.sedt6 ----- 
lotto.sedt7=createEdit(lotto.spnl2)
lotto.sedt7.AutoSize=false
lotto.sedt7.height=22*DP1 lotto.sedt7.width=300*DP1 lotto.sedt7.left=10*DP1 lotto.sedt7.top=422*DP1
lotto.sedt7.text=""
lotto.sedt7.alignment="taLeftJustify"
lotto.sedt7.Font.Style="fsBold" lotto.sedt7.Font.Size=10*DP1
-----------------------
----------------------- lotto.sbtn2 ----- 
lotto.sbtn2=createButton(lotto.spnl2)
lotto.sbtn2.AutoSize=false
lotto.sbtn2.height=25*DP1 lotto.sbtn2.width=140*DP1 lotto.sbtn2.left=10*DP1 lotto.sbtn2.top=452*DP1
lotto.sbtn2.caption="Print List"
lotto.sbtn2.Font.Style="fsBold" lotto.sbtn2.Font.Size=10*DP1
-----------------------
----------------------- lotto.sbtn3 ----- 
lotto.sbtn3=createButton(lotto.spnl2)
lotto.sbtn3.AutoSize=false
lotto.sbtn3.height=25*DP1 lotto.sbtn3.width=145*DP1 lotto.sbtn3.left=165*DP1 lotto.sbtn3.top=452*DP1
lotto.sbtn3.caption="Clear List"
lotto.sbtn3.Font.Style="fsBold" lotto.sbtn3.Font.Size=10*DP1
-----------------------
--############################################################################--
lotto.smbtn1.OnClick=function()
sfrm1.WindowState = "wsMinimized"
end

lotto.smbtn2.OnClick=function()
closeCE()
return caFree
end
--############################################################################--

lotto.sbtn1.Caption="Start"

  for i,k in pairs(lotto) do
    aa11 = string.sub(i,1,4)
    if aa11=="sedt" then
     lotto[i].OnClick=function() lotto[i].Text="" end
     lotto[i].Text=""
     lotto[i].Color=16776960
     if i~="sedt7" then
      lotto[i].OnChange=function(sender)
       local s=sender.Text
       if s=='' then return end
         local b=tonumber(sender.Text)
         if b==nil then
           sender.Text=""
           showMessage("Please write a number!")
         end
       end
      end
    end
  end

sfrm1.Visible=true
sfrm1.setLayeredAttributes(0x000100, 255, LWA_COLORKEY | LWA_ALPHA )
sfrm1.Color=0x000100

if ftim1 then ftim1.Destroy() ftim1=nil end
ftim1=createTimer(MainForm) ftim1.Interval=100
ftim1.Enabled=false

local fnres1 = {}
local fnres2 = {}
local listTbl = {}

function clear1(t)
    for k in pairs(t) do
        t[k] = nil
    end
end

function itemCheck(tbl)
local hash = {}
local res = {}
for _,v in ipairs(tbl) do
   if (not hash[v]) then
       res[#res+1] = v
       hash[v] = true
   end
end
return res
end
--------------------------------------------------------------------------------

function itemCheck1(tbl,st)
local res = 0
  for _,v in pairs(tbl) do
   if v==st then
       res=tonumber(res) + 1
   end
  end
return res
end

function checkTbl1(tbl)
aa44 = 0
aa55 = 0
ltbl1 = {}
ltbl2 = {}
local stbl = itemCheck(tbl)
  for _,v in pairs(stbl) do
    aa22 = itemCheck1(tbl,v)
    aa55=aa22 aa44=v --end
    aa66 = {aa55,aa44}
    table.insert(ltbl2, aa66)
  end
  table.sort(ltbl2, function(a,b) return a[1] > b[1] end)
    for i=1, tonumber(lotto.sedt5.Text) do
     print(ltbl2[i][1],ltbl2[i][2])
      table.insert(ltbl1, {ltbl2[i][1],ltbl2[i][2]})
    end
     table.sort(ltbl1, function(a,b) return a[2] < b[2] end)
      res1 = ""
      for i=1, tonumber(lotto.sedt5.Text) do
       res1 = res1..ltbl1[i][2].." ("..ltbl1[i][1]..")".."   "
      end
      lotto.sedt7.Text = res1
end

lotto.sedt1.Text = 1
lotto.sedt2.Text = 34
lotto.sedt5.Text = 5
lotto.sedt6.Text = 10

function startMaxVal()
local listTbl = {}
       for i,k in pairs(fnres1) do
        for word in k:gmatch("%w+") do
          table.insert(listTbl, tonumber(word))
         end
        end
      aa55 = checkTbl1(listTbl)
end
--------------------------------------------------------------------------------

ftim1.OnTimer=function()
aa5 = ""
local var = ""
local var1 = ""
local aa1 = 0
  if #fnres1==tonumber(lotto.sedt6.Text) then
     startMaxVal(tbl)
     ftim1.Enabled=false
      for i,k in pairs(fnres1) do
        if i < 10 then var = '0'..i else var = i end
        lotto.smemo1.Lines.Add(var..") "..k)
        --print(i,k)
      end
      lotto.sbtn1.Caption="Start"
  else
      for j=1, tonumber(lotto.sedt5.Text) do
        aa1 = math.random(tonumber(lotto.sedt1.Text),tonumber(lotto.sedt2.Text))
        fnres2[j] = aa1
      end
      aa2 = itemCheck(fnres2)
       if #aa2==tonumber(lotto.sedt5.Text) then
       table.sort(fnres2)
        for l,k in pairs(fnres2) do
          if k < 10 then var1 = "0"..k else  var1 = k end
            aa5 = aa5 .. " " .. var1
          end
         if lotto.scbox.State==1 then
           aa6 = math.random(tonumber(lotto.sedt3.Text),tonumber(lotto.sedt4.Text))
           aa5 = aa5 .. " + " .. aa6
         end
         fnres1[#fnres1 + 1] = aa5
         lotto.slbl5.Caption=#fnres1 .. "  : Completed "
         clear1(fnres2)
       else
         clear1(fnres2)
       end
  end
end

lotto.sbtn1.OnClick=function()
     if ftim1.Enabled==false then
      if lotto.sedt1.Text~="" and lotto.sedt2.Text~="" and lotto.sedt5.Text~="" and lotto.sedt6.Text~="" then
        clear1(fnres1) clear1(fnres2)
        lotto.sbtn1.Caption="Wait!"
        ftim1.Enabled=true
      else
        showMessage("Please write the required data completely!")
        lotto.sbtn1.Caption="Start"
        ftim1.Enabled=false
      end
  else
        lotto.sbtn1.Caption="Start"
    ftim1.Enabled=false
  end
end

lotto.scbox.OnChange=function()
 if lotto.scbox.State==1 then
  if lotto.sedt3.Text=="" or lotto.sedt4.Text=="" then
    showMessage("Please write the starting and\nending values in the relevant boxes!")
    lotto.scbox.State=0
  end
 end
end

lotto.sbtn3.OnClick=function()
lotto.smemo1.Clear()
end

lotto.sbtn2.OnClick=function()
path = TrainerOrigin or MainForm
name = "loto_"..os.time()..".txt"
pth = path..name
  if pth then
    sl = createStringList()
    sl.Text=lotto.smemo1.Lines.Text
    sl.saveToFile(pth)
    sl.Destroy()
    shellExecute(pth)
  end
end


If there is a lotto type you would like to add, please specify it in the comments.

Until we come up with another crazy idea, enjoy it!

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> LUA Tutorials All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites