Blazephlozard

Rats RNG formula

Aug 17th, 2021 (edited)
1,434
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.30 KB | None | 0 0
  1.     --totally irrelevant formula for calculating average length of time to cook a bag in rats / cook off
  2.     --when i'm modding, it's easier to slap this stuff in a mod and run it in-game than try and execute it on its own
  3.     --[[rats numbers
  4.     local startP = 0.05
  5.     local incP = 0.10
  6.     local delay = 25]]
  7.     --cookoff numbers
  8.     local startP = 0.07
  9.     local incP = 0.15
  10.     local delay = 22.5 --20 to 25... or is it 21 to 25?
  11.    
  12.     local sanitycheck = 0
  13.     local expectedvalue = 0
  14.     local baseodds = 1
  15.     local numdelays = 0
  16.    
  17.     for i=startP,2,incP do
  18.         if (i > 1) then i = 1 end
  19.         baseodds2 = baseodds
  20.         numdelays2 = numdelays
  21.         for j=i,2,incP do
  22.             if (j > 1) then j = 1 end
  23.             numdelays2 = numdelays2 + 1
  24.             baseodds3 = baseodds2
  25.             numdelays3 = numdelays2
  26.             for k=j,2,incP do
  27.                 if (k > 1) then k = 1 end
  28.                 --three ingredients added!
  29.                 numdelays3 = numdelays3 + 1
  30.                 local theodds = baseodds3 * i * j * k
  31.                
  32.                 sanitycheck = sanitycheck + theodds
  33.                 expectedvalue = expectedvalue + theodds * (numdelays3 * delay)
  34.                 log(sanitycheck .. ", " .. expectedvalue)
  35.                 baseodds3 = baseodds3 * (1 - k)
  36.                 if (k == 1) then break end
  37.             end
  38.             baseodds2 = baseodds2 * (1 - j)
  39.             if (j == 1) then break end
  40.         end
  41.         baseodds = baseodds * (1 - i)
  42.         numdelays = numdelays + 1
  43.         if (i == 1) then break end
  44.     end
  45.    
Advertisement
Add Comment
Please, Sign In to add comment