Number "randomness" test

Find out how to setup your programmer's software and how to solve many common problems.

Moderator: phalanx

Post Reply
skimask
Support Volunteer
Posts: 1244
Joined: Sun Nov 09, 2008 2:11 am
Location: Minot, N.D.

Number "randomness" test

Post by skimask » Wed Jul 02, 2014 11:30 pm

Looking for a quick-n-dirty randomness test.
Using a PIC to generate 2 9-bit numbers, x & y on a grid, 512x512.
"Homemade" LFSR method using a high speed timer and USB interrupts to add some entropy to the output.
Ran a loop of 131,072 counts, 1/2 of 252,144 (512x512), got 103,240 different points set, meaning 27,832, 21.2% of 131,072 were duplicates.
This is what the X/Y plot looked like when it got done:
randomtest1.jpg
I don't see any recognizable pattern.
Anybody else?
(of course posting the picture as a high quality jpeg didn't doesn't do much good now does it...)
I ignore "one post wonders".

Dave Mueller
Posts: 198
Joined: Sat Apr 30, 2011 8:09 pm

Re: Number "randomness" test

Post by Dave Mueller » Thu Jul 03, 2014 6:17 am

"Wow. It's a schooner."

skimask
Support Volunteer
Posts: 1244
Joined: Sun Nov 09, 2008 2:11 am
Location: Minot, N.D.

Re: Number "randomness" test

Post by skimask » Thu Jul 03, 2014 1:36 pm

Dave Mueller wrote:"Wow. It's a schooner."
:)
I ignore "one post wonders".

Valen
Support Volunteer
Posts: 1744
Joined: Wed Dec 22, 2010 2:05 am

Re: Number "randomness" test

Post by Valen » Thu Jul 03, 2014 4:25 pm

The patern looks like sandpaper to me.

skimask
Support Volunteer
Posts: 1244
Joined: Sun Nov 09, 2008 2:11 am
Location: Minot, N.D.

Re: Number "randomness" test

Post by skimask » Thu Jul 03, 2014 10:22 pm

Grit on sandpaper is random...right?

I guess all other things being equal (or not equal in this case), it looks random enough for the average dude and his PICs...
I ignore "one post wonders".

Valen
Support Volunteer
Posts: 1744
Joined: Wed Dec 22, 2010 2:05 am

Re: Number "randomness" test

Post by Valen » Fri Jul 04, 2014 3:35 am

I don't really know how they measure randomness. I guess it involves taking fourier transforms and see if there are peaks in the spectrum.

skimask
Support Volunteer
Posts: 1244
Joined: Sun Nov 09, 2008 2:11 am
Location: Minot, N.D.

Re: Number "randomness" test

Post by skimask » Fri Jul 04, 2014 12:02 pm

Good idea. LibreOffice does that.
The data set is in a simple file:
X value #1 <CR/LF>
Y value #1 <CR/LF>
X value #2 <CR/LF>
Y value #2 <CR/LF>
and so on.
Piece of cake to import.
I ignore "one post wonders".

Post Reply