flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 12 Jul 2019, 09:21
It depends upon your definition of "random".
You can use %t to get the current time. It isn't really random but might serve for your purpose as a seed value. Otherwise use an external file to grab some random bytes and insert those. If you have Linux then /dev/urandom could suffice. |
|||
![]() |
|
Tomasz Grysztar 12 Jul 2019, 09:51
If pseudo-random numbers would be enough for you, my article about types of multi-pass assembly contains some Xorshift macros for fasmg that I used to generate randomized sources. You could make something similar for fasm 1, though you'd have to do it a bit differently to avoid overflows.
|
|||
![]() |
|
edfed 12 Jul 2019, 12:49
Code: macro Random n{ p = ((%t mod n) mod 14) + 1 db n and 0xff db p repeat 14 if % = p db (%t shr n) and 0xff ; here i want to make a random byte else db 0xff end if end repeat } repeat 256 Random % end repeat this code makes what i wanted. thanks ![]() |
|||
![]() |
|
edfed 18 Jul 2019, 15:04
this single line makes a good enough random source
Code: RNDT equ ($ + %t) |
|||
![]() |
|
revolution 18 Jul 2019, 16:10
![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.