FilterFactory - Function "rnd"

Back to function listing

Random number between a and b, inclusive
Note: Modifies internal state

Syntax

rnd(a,b)

To change the seed, use rst(i)

rnd(0,255) does not initialize itself to e.g. some image properties or the clock.
The random values are always:
seed=0: 10, 35, 106, 115, 158, 111, 120, 91, 134, ...
seed=1: 148, 64, 179, 0, 248, 199, 35, 163, 176, ...
...

More information and disassembly, see Randomization procedures

Implementation in Windows plugin 3.00a (beta version) and 3.00b (internal build)

In version 3.00a (beta version) and version 3.00b (internal build), if b<a, the result was not 0. Fixed the final version of 3.00.

Version 3.00a (beta version) and 3.00b (internal build) Version 3.00 (final) and 3.0.4
lea ebx,[edi+0x94]
mov ax,WORD PTR [ebx+0x2]
inc ax
cmp ax,0x38
jne 0x16
mov ax,0x1
mov WORD PTR [ebx+0x2],ax
mov ax,WORD PTR [ebx]
inc ax
cmp ax,0x38
jne 0x29
mov ax,0x1
mov WORD PTR [ebx],ax
movzx eax,WORD PTR [ebx]
lea ecx,[ebx+eax*4+0x4]
mov eax,DWORD PTR [ecx]
movzx edx,BYTE PTR [ebx+0x2]
sub eax,DWORD PTR [ebx+edx*4+0x4]
mov DWORD PTR [ecx],eax
pop esi
pop ecx
sub esi,ecx




inc esi
sub edx,edx
div esi
lea eax,[ecx+edx*1]

push eax
lea ebx,[edi+0x94]
mov ax,WORD PTR [ebx+0x2]
inc ax
cmp ax,0x38
jne 0x16
mov ax,0x1
mov WORD PTR [ebx+0x2],ax
mov ax,WORD PTR [ebx]
inc ax
cmp ax,0x38
jne 0x29
mov ax,0x1
mov WORD PTR [ebx],ax
movzx eax,WORD PTR [ebx]
lea ecx,[ebx+eax*4+0x4]
mov eax,DWORD PTR [ecx]
movzx edx,BYTE PTR [ebx+0x2]
sub eax,DWORD PTR [ebx+edx*4+0x4]
mov DWORD PTR [ecx],eax
pop esi
pop ecx
sub esi,ecx
jns @@1          ; added
xor eax,eax      ; added
jmp @@2          ; added
@@1:
inc esi
sub edx,edx
div esi
lea eax,[ecx+edx*1]
@@2:
push eax