lingo12, nice - do you have some ideas about the genrand_int32 PROC?
Posted on 2003-03-09 22:52:50 by bitRAKE
I'm not sure how best to test for "randomness",


Here's a nice program that does various tests:
http://www.fourmilab.ch/random/
Posted on 2003-03-09 23:17:37 by iblis
Posted on 2003-03-10 00:30:11 by bitRAKE
As far as randomisation is concerned how about the algo used in colib to generate GUIDs?

They say its not gonna duplicate for the next 1000 years , nor are any of us too, so why not just use that?

I know its not open source, but then you could always disassemble colib and its function to read. Shouldnt be too hard to follow.
Posted on 2003-03-11 02:11:04 by clippy
The reason that it's not duplicating is because there are 2^128 numbers to choose from :).
Posted on 2003-03-11 05:42:59 by gliptic

Sure only way of real randomizer is additional hardware.


Why Additional hardware? You could seed the random generator with the soundcard init. routine noise. I've seen an algo some time ago, let me find it.
Posted on 2003-03-11 08:16:29 by pelaillo
Hi all

The only way to get TRUE Random Numbers, is with aditional hardware
with software you only get Pseudorandom numbers, this is because Computers are Deterministic beast. the output you get from rand(), or ANY software based routine may seem random but will never pass a test for randomess.
the ardware for a RNG is not too complex, A reverse biased diode (above breakdown) a small amp/squarer, an and gate and a counter/shift register tied to a couple of I/O ports will give you true random numbers by the score,
Posted on 2003-03-12 12:00:45 by Carlos
try checking this site www.random.org. They have a sample programs that can retreive random numbers from atmospheric noise. http://www.random.org/clients/
Posted on 2003-03-13 11:37:16 by arkane
there is an article with more than 28 pseudo-random algos in the Natural Selection Issue #1 virii zine (asm)
Posted on 2003-03-16 13:42:19 by bart
Random numbers are relative.

There will always be a finit amount of repeatablility in any given SET of produced "random" numbers. The diode example itself would seem random, but there is a finite explaination of how and when carriers migrate (ie function of temp, silicon doping, voltage, current, etc). But the point is, its FINITE.

The mear fact we havent the FINITE math to show this preciecely doesnt mean it isnt. Which is why we are left to say it 'appears' random.

Bringing this to a point. The ability to appear random is only relative to our ability to detect *any* form of pattern.

Even if a test generator defies all prediction, but its average is always less than 40% then it shows the beginning of a pattern (thus it can be labled 'Pseudo random' on this fact alone!).

The human mind is best set to 7 digits of short term memory (on average). Beyond this, memory fades. If your pseudo-random generator can produce a repeating pattern in the order of 1000's you laughing for 99% of all practical applications. Again, its all relative to what you need to achieve 'randomly'.

:NaN:
Posted on 2003-03-27 22:09:05 by NaN
Howdy, here's my random:



org 256

call set320x200x256
call initrandomz


mainloop:

mov ecx,319
call randomz2
mov bx,ax

mov ecx,199
call randomz2
mov cx,ax

push ecx
mov ecx,255
call randomz2
pop ecx

call putpixel320x200x256 ; al=color bx=x cx=y

push eax
call bkeycheck
cmp al,27
pop eax
jnz mainloop

call set80x25t

int 20h

initrandomz: ; modifies edx, eax
rdtsc
ret

randomz2: ; Z2 ecx=range transparent
push ebx
push edx
mov ebx,eax
rdtsc

xor ebx,eax
push ecx
mov cx,bx
rol eax,cl

push cx
and cx,$f
btc ax,cx
pop cx

mov cl,ch
ror eax,cl

and cx,$f
btc ax,cx

pop ecx

mul ecx
mov eax,edx
pop edx
pop ebx
ret

putpixel320x200x256: ; al=color, bx=x, cx=y
push es
push $A000
pop es
mov di,cx ; y
shl cx,2
add di,cx ; 5y
shl di,6 ; 320y
add di,bx
stosb
pop es
ret

bkeycheck: ;returns: AH = BIOS scan code AL = ASCII character note: enhanced
mov ah,0x11 ;Return: ZF set if no keystroke available, ZF clear if keystroke available
int 0x16 ;only checks buffer without removing key
ret

set320x200x256:
mov ax,$13
int $10
ret

set80x25t:
mov ax,$03
int $10
ret


it is enough for me
i could make it run on a 386 with PIT timer

MATRIX
Posted on 2004-09-29 19:16:54 by >Matrix<
A good source for seed values is the QueryPerformanceCounter API function. If you need a dword just use the lower dword of the result.
Posted on 2004-09-29 21:16:27 by Greg

Originally posted by Kayaker:

I'm not sure how best to test for "randomness"


The program ent (http://www.fourmilab.ch/random/) can generate various statistical measures from a stream of bytes thus giving some measure of "randomness" of the bytes.
Posted on 2004-10-02 17:51:39 by Poimander
You can't get real random algo.

I wonder though, if you could get access to the raw binary feed than comes in through the modem and at the same time pick up your phone and blow onto it would that create a random binary string. Hmmmmm, maybe not :(


it looks to me like random noice :-D
Posted on 2004-10-03 17:47:17 by AceEmbler
Random data is all around us, e.g. the noise from a Geiger counter. Somebody mentioned using the sound card; good idea. Record radio static. For pseudorandom data, I sometimes just compress some big file with ZIP or ARJ, snip off the file header, and then XOR the data with some other such material.

Measuring randomness, so that you can rigorously say that such-and-such is "99% random", for example, is a ticklish mathematical specialty. But in practice you can judge when 100 bits of data contain at least 90 bits' worth of randomness. If you need x bits' worth, just multiply x by 100/90 and use that amount of the semi-random data.
Posted on 2004-10-08 03:29:01 by LarryH

I don't quite understand the random concept..
Something may only seem random..?
I mean like chaotic system, like of fractals and stuff, they seem produce random result but there is a system behind it
So it's not really random, or? It's not random if there was a system behind it?

If a 'real random algo' could exist theoretically, how would it work like?

One aspect of randomness is unpredictability. Or, in other words, if you can predict the next number, it isn't random.
Posted on 2004-10-08 18:42:40 by tenkey
I don't think its MASM, but Anger Fog distributes his Mersenne twister source code here along with others. Most already know of Ranrot.

Yes! That's ORG program language is C, not Asm..

because, C programmer look 'inc' will remark "++" , look 'xor' will remark "^"
Ex:
    inc eax         ; eax++

xor eax, ebx ; eax ^= ebx


but, Asm programmer look '++' will remark "inc" , look '^' would remark "xor"
ex:
    i++;        //  inc  i

i ^= 5; // i = i xor 0101b
Posted on 2004-10-15 02:54:33 by Kestrel
Theres several online sources of "genuine" random numbers that are worth a look, it means adding code to fetch a webpage and means the app won't work without internet, but for internet applications this is not a problem.
The methods used to generate these numbers vary from sampling radioactive decay, thermal ambient noise and radio whitenoise to name a few.
The cosmos speaks to us, yet we choose not to listen :)
Posted on 2004-10-29 03:08:17 by Homer
Theres several online sources of "genuine" random numbers that are worth a look, it means adding code to fetch a webpage and means the app won't work without internet, but for internet applications this is not a problem.
The methods used to generate these numbers vary from sampling radioactive decay, thermal ambient noise and radio whitenoise to name a few.

But then your 'random' data is not even pseudo-random. It is a copy of the 'random' data the site generated. This is very insecure...
Posted on 2004-10-29 04:48:12 by death
hi,

in regards to the online random systems i wrote a little java program + article here: http://superhappycool.blogspot.com/2004/10/article-really-random-numbers.html that takes some of the previously mentioned online sites (random.org, fourmilab, other) and combines the random streams from them to produce a "really" random stream.

it's secure (pending a few concerns discussed in the article) because you use multiple sources for your inputs so one compromised source or "aware" source (tracking the numbers) can't harm you.

have a look it at, it's really simple and can be made to assembly easily :)
Posted on 2004-11-04 18:01:55 by abc123