kolibrios-fun/programs/develop/libraries/utils/trunk/_rand.inc
Akyltist 9b11245e08 Add COFF libraries "utils.obj" atof,ftoa,random
support for exponent, high accuracy, not normalized form of writing

git-svn-id: svn://kolibrios.org@4721 a494cfbc-eb01-0410-851d-a64ba20cac60
2014-03-31 05:57:30 +00:00

35 lines
945 B
PHP
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;-----------------------------------------------------------------------------+
; ”ã­ªæ¨ï £¥­¥à æ¨¨ á«ãç ©­®£® ç¨á«  ¢ ¤¨ ¯®§®­¥ 0..99999 |
;-----------------------------------------------------------------------------+
; <EFBFBD>  ¢ë室¥ : eax - á«ãç ©­®¥ ç¨á«® |
;-----------------------------------------------------------------------------+
_random:
push edx ecx ebx
mov eax,ebx
or eax,eax
jnz @f
rdtsc
xor eax,edx
mov ebx,eax
@@:
xor edx,edx
mov ecx,127773
div ecx
mov ecx,eax
mov eax,16807
mul edx
mov edx,ecx
mov ecx,eax
mov eax,2836
mul edx
sub ecx,eax
xor edx,edx
mov eax,ecx
mov ebx,ecx
mov ecx,100000
div ecx
mov eax,edx
pop ebx ecx edx
ret
;->