flat assembler
Message board for the users of flat assembler.
Index
> Main > Random Number Generator in FASM Goto page 1, 2 Next |
Author |
|
HyperVista 03 Aug 2006, 10:01
Привет Angler!
Here's a link you may find helpful http://www.random.org/ For me, it's not advised to write your own encryption because it is so difficult to get it correct and not provide weak encryption by mistake. We have a name for self written encryption ... "encraption". It's best to use well established libraries for encryption work. Успехов! |
|||
03 Aug 2006, 10:01 |
|
Angler 03 Aug 2006, 10:06
Большое спасибо! Ща загляну! Than you very much!
|
|||
03 Aug 2006, 10:06 |
|
HyperVista 03 Aug 2006, 10:22
Пожалуйста
Here are some ASM examples of RNGs and support files. Source is :http://www.agner.org/random/
|
|||||||||||
03 Aug 2006, 10:22 |
|
UCM 03 Aug 2006, 12:24
I happen to have a translation of a 'xorshift' algorithm from C. Here it is:
_________________ This calls for... Ultra CRUNCHY Man! Ta da!! *crunch* |
|||||||||||
03 Aug 2006, 12:24 |
|
Angler 05 Aug 2006, 15:25
HyperVista, how to oficcially ask in english "Довольны ли вы своей зарплатой?"(1) & "А мы и не сомневались, что вы так ответите."(2)?
Я эксперементирую, и хочу просто создать прикольную программу, которая спрашивает (1), на форме две кнопки (Да, Нет). Когда юзер наводит на "Нет", эта кнопка "убегает". Пользователю ничего не остаётся, как ответить "Да". Ну и тут сообщение (2). Классный прикол! Правда старый, но мне нравится! Довольно странный вопрос кого-то перевести что это значит на другом языке, но всё же? В любом случае спасибо!! |
|||
05 Aug 2006, 15:25 |
|
Angler 05 Aug 2006, 15:32
I've been studying these RNG last 2 days. But it's too hard to write own function, so it's better to use established one.
|
|||
05 Aug 2006, 15:32 |
|
zhak 05 Aug 2006, 16:46
Try RtlRandom and RtlRandomEx (WinXP or better) from ntdll.dll.
This functions do not pass any statistical tests (diehard, nist), but they may be used for the task you described, I think. |
|||
05 Aug 2006, 16:46 |
|
Angler 06 Aug 2006, 05:13
Thank you zhak! What i've described is a small useless program. It can be used only as example.
I find it difficult to write my own RNG function, so this small prog uses library from Agner Fog. Sorry for english, Here that useless program! By the way, how to write this code in FASM and what does it mean? Code: MOV [M0][ECX*4], EAX (I met it when i was translating MASM code into FASM)
|
|||||||||||
06 Aug 2006, 05:13 |
|
HyperVista 06 Aug 2006, 16:35
Привет Angler!
The english translation of your questions is a little difficult, but I'll give it a try: Are you satisfied with your salary? (Yes or No) We knew you would answer yes I know a young person here who is Russian and speaks very good english (he's the brother of my daughter's friend). He is very interested in programming and can help you translate your program prompts to english. You can e-mail him at markov792004@yahoo.com. He'd be happy to assist you. Успехов! |
|||
06 Aug 2006, 16:35 |
|
Sasha 21 Jun 2013, 13:30
I wrote, seems, the simplest implementation of decent linear congruential generator. According to http://en.wikipedia.org/wiki/Linear_congruential_generator the a=69069 ,c=1 and m=2^32 were used in old versions of glibc
Code: Rand: ;Linear congruential generator mov eax,[X0] ;X0 mov edx,69069 ;a=69069 mul edx inc eax ;c=1 mov [X0],eax ret Let's leave c=1 and m=2^32. I want to find other a's that will give a good sequense. If you will use this code in your project, please let me know, if it works good. And don't use it in cryptography! |
|||
21 Jun 2013, 13:30 |
|
Sasha 23 Jun 2013, 09:13
There are some variations of parameters on this page
http://www.gnu.org/software/gsl/manual/html_node/Other-random-number-generators.html As we can see, some of them don't require even the incremention so they are truly multiplicative. Code: Rand: ;Linear congruential generator mov eax,[X0] ;X0 mov edx,1664525 ;a=1664525, 1812433253, 1566083941 mul edx mov [X0],eax ret |
|||
23 Jun 2013, 09:13 |
|
revolution 23 Jun 2013, 09:53
I only ever use LCGs where low speed and low quality are not a problem. A trivial computer game would be a good usage case for an LCG.
|
|||
23 Jun 2013, 09:53 |
|
Sasha 23 Jun 2013, 12:18
Yes, only one multiplication, but so slow!!!
Now I'm working on mersenne twister and xorshift algorithms. |
|||
23 Jun 2013, 12:18 |
|
AsmGuru62 23 Jun 2013, 13:05
I have posted the Mersenne Twister here:
http://board.flatassembler.net/topic.php?t=13741 |
|||
23 Jun 2013, 13:05 |
|
revolution 23 Jun 2013, 13:48
Sasha wrote: Yes, only one multiplication, but so slow!!! |
|||
23 Jun 2013, 13:48 |
|
Sasha 23 Jun 2013, 16:36
If it would be possible to make extremely fast implementation of LCG, the period could be extended by choosing larger numbers.
|
|||
23 Jun 2013, 16:36 |
|
Sasha 23 Jun 2013, 16:41
AsmGuru62 wrote: I have posted the Mersenne Twister here: Thank you, I think it'll be very usefull. I'm trying to understand the algorithm. |
|||
23 Jun 2013, 16:41 |
|
AsmGuru62 23 Jun 2013, 19:56
I used pseudocode from here:
http://en.wikipedia.org/wiki/Mersenne_twister |
|||
23 Jun 2013, 19:56 |
|
revolution 24 Jun 2013, 00:16
Sasha wrote: If it would be possible to make extremely fast implementation of LCG, the period could be extended by choosing larger numbers. |
|||
24 Jun 2013, 00:16 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.