 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Peeszdyetc How do I cheat?
Reputation: 0
Joined: 27 Jun 2023 Posts: 4
|
Posted: Sat Jul 01, 2023 2:56 pm Post subject: [Auto Assemble] Generate random number from 0 to K |
|
|
Posting it here because google forward me to this forum firstly but I'm not found a final solution here. Can't even post a link to source because of forum restrictions. You can find the solution on fearlesssrevolution forums by exact same thread name as this.
Source: fearlessrevolution*com/viewtopic.php?f=23&t=25089&p=302778#p302778
| Code: | [Enable]
alloc(start, 2048)
label(originalcode)
label(exit)
label(randomValue)
label(returnhere)
start:
pushad
mov eax, 0x2000001
cpuid
rdtsc
and eax, K
mov [randomValue], eax
popad
originalcode:
mov eax, [randomValue]
mov ebp,eax
mov edi, [...]
exit:
jmp returnhere
randomValue:
dd 0
...:
jmp start
nop 3
returnhere:
[Disable]
dealloc(start)
...
|
|
|
| Back to top |
|
 |
Csimbi I post too much
Reputation: 97
Joined: 14 Jul 2007 Posts: 3326
|
Posted: Sat Jul 01, 2023 7:28 pm Post subject: |
|
|
rdtsc reads a timestamp counter - it's the opposite of random, it's counting up until processor reset.
I'd try the rdrand instruction instead.
| Code: | rdrand ax
rdrand eax
rdrand rax
|
All of these are valid. You can use EBX, ECX, or any other register.
Check the Intel Developer's Manual, some conditions apply.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25814 Location: The netherlands
|
Posted: Sat Jul 01, 2023 11:59 pm Post subject: |
|
|
value & k ?
that means the K can only be 1,3,15,31, etc...
lets say that K is 8, then the only 2 values this random value generator returns is either 0 or 8
i'd do:
| Code: |
call rand //or rdtsc if you prefer
push rdx
div dword ptr [Kvalue] //divide the value in eax by kvalue. The result will be in eax and edx, where eax contains the number of times it can be divided, and edx the result left (which goes from 0 to K-1)
mov [randomValue],edx //put the remainder in randomValue
pop rdx
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
|
|
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 can download files in this forum
|
|