<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="19">
  <CheatEntries>
    <CheatEntry>
      <ID>1</ID>
      <Description>"Generate Pseudorandom Numbers"</Description>
      <Options moHideChildren="1"/>
      <LastState/>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>{ Author: ParkourPenguin
  Date: 27 / 03 / 2016

  This script generates a pseudorandom number between [lowerBound] and
  [upperBound] (inclusive) every [interval] ms. Stored in myRandomNumber.

  Please note that msvcrt.rand is only guaranteed to return a number from 0
  to 32767.
}
[ENABLE]
alloc(newmem,2048)
label(asTimeGoesBy)
label(lowerBound)
label(upperBound)
label(interval)
label(myRandomNumber)
label(shouldExit)

registersymbol(lowerBound)
registersymbol(upperBound)
registersymbol(interval)
registersymbol(myRandomNumber)
registersymbol(shouldExit)

createthread(newmem)

newmem:
  call kernel32.GetTickCount
  push eax
  call msvcrt.srand
  add esp,4
asTimeGoesBy:
  call msvcrt.rand
  xor edx,edx
  mov ebx,[lowerBound]
  mov ecx,[upperBound]
  cmp ecx,ebx
  cmovl ecx,ebx
  inc ecx
  sub ecx,ebx
  idiv ecx
  add edx,ebx
  mov [myRandomNumber],edx
  push [interval]
  call kernel32.Sleep
  cmp [shouldExit],0
  je asTimeGoesBy
// free memory, return
  pop eax
  push 8000
  push 0
  push newmem
  push eax
  jmp kernel32.VirtualFree
  db CC CC CC CC CC CC
lowerBound:
  dd #10
upperBound:
  dd #20
interval:
  dd #1000
myRandomNumber:
  dd 0
shouldExit:
  dd 0

[DISABLE]
shouldExit:
  dd 1

unregistersymbol(lowerBound)
unregistersymbol(upperBound)
unregistersymbol(interval)
unregistersymbol(myRandomNumber)
unregistersymbol(shouldExit)
</AssemblerScript>
      <CheatEntries>
        <CheatEntry>
          <ID>2</ID>
          <Description>"Lower Bound"</Description>
          <ShowAsSigned>1</ShowAsSigned>
          <VariableType>4 Bytes</VariableType>
          <Address>lowerBound</Address>
        </CheatEntry>
        <CheatEntry>
          <ID>3</ID>
          <Description>"Upper Bound"</Description>
          <ShowAsSigned>1</ShowAsSigned>
          <VariableType>4 Bytes</VariableType>
          <Address>upperBound</Address>
        </CheatEntry>
        <CheatEntry>
          <ID>4</ID>
          <Description>"Update Interval"</Description>
          <VariableType>4 Bytes</VariableType>
          <Address>interval</Address>
        </CheatEntry>
        <CheatEntry>
          <ID>5</ID>
          <Description>"Pseudorandom Number"</Description>
          <ShowAsSigned>1</ShowAsSigned>
          <VariableType>4 Bytes</VariableType>
          <Address>myRandomNumber</Address>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
  </CheatEntries>
  <UserdefinedSymbols/>
</CheatTable>
