Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.asm.x86 > #1648

Fast and small Multiplicative Random number generator

From hopcode <hopcode@nospicedham.nulnulul.de>
Subject Fast and small Multiplicative Random number generator
Message-ID <jcnd08$ibm$1@online.de> (permalink)
Date 2011-12-19 14:08 +0100
Organization 1&1 Internet AG
Newsgroups comp.lang.asm.x86, alt.lang.asm

Cross-posted to 2 groups.

Show all headers | View raw


Hi everybody,

some days ago i started thinking upon a
fast and simple random number generator of few
lines of codes, wondering about the use of
MUL and RDTSC. after some "deviations" from the theory :-)
i stumbled upon this following idea of mine:

.randomB:
    rdtsc
    mov rcx,866AA7'3F0B'7F'0B'03h
    movd mm0,eax
    movq mm1,rcx
    pshufw mm0,mm0,00'10'01'00b
    pmaddwd mm1,mm0
    pshufb mm1,mm0
    pmullw mm1,mm0
    movq rax,mm0
    movq rcx,mm1
    mul rdx
    sub rax,rcx
    ret

then using ENT to test some of its features
here what i have found:

ent result.bin
Entropy = 7.841899 bits per byte.

Optimum compression would reduce the size
of this 130800 byte file by 1 percent.

Chi square distribution for 130800 samples is 29972.95, and randomly
would exceed this value less than 0.01 percent of the times.

Arithmetic mean value of data bytes is 129.7706 (127.5 = random).
Monte Carlo value for Pi is 3.139266055 (error 0.07 percent).
Serial correlation coefficient is -0.001012
(totally uncorrelated =0.0).

i dont know how to read it to evaluate my algo.
could you please help me ?

ent link is at
http://www.fourmilab.ch/random/

and the following 2 screenshots using gnuplot

total distribution of 65536 items ANDED to 65535
http://sites.google.com/site/x64lab/randomB_ganz.gif?attredirects=0

and a detail of it
http://sites.google.com/site/x64lab/randomB_detail.gif?attredirects=0

i have drawn some blu lines to denote visible
constant "holes" inside it.

Hints, general guidelines about the subject,
improvements, your opinion on the results well appreciated

Thanx in advance,
Cheers,

-- 
.:mrk[hopcode]
   .:x64lab:.
  group http://groups.google.com/group/x64lab
  site http://sites.google.com/site/x64lab

Back to comp.lang.asm.x86 | Previous | NextNext in thread | Find similar


Thread

 Fast and small Multiplicative Random number generator  hopcode <hopcode@nospicedham.nulnulul.de> - 2011-12-19 14:08 +0100
  Re: Fast and small Multiplicative Random number generator Markus Wichmann <nullplan@nospicedham.gmx.net> - 2011-12-19 21:10 +0100
     Re: Fast and small Multiplicative Random number generator  hopcode <hopcode@nospicedham.nulnulul.de> - 2011-12-20 07:33 +0100
      Re: Fast and small Multiplicative Random number generator "Rod Pemberton" <do_not_have@nospicedham.noavailemail.cmm> - 2011-12-20 11:06 -0500
   Re: Fast and small Multiplicative Random number generator  hopcode <hopcode@nospicedham.nulnulul.de> - 2011-12-20 14:59 +0100
    Re: Fast and small Multiplicative Random number generator Bernhard Schornak <schornak@nospicedham.web.de> - 2011-12-21 00:28 +0100
       Re: Fast and small Multiplicative Random number generator  hopcode <hopcode@nospicedham.nulnulul.de> - 2011-12-21 05:49 +0100
        Re: Fast and small Multiplicative Random number generator Bernhard Schornak <schornak@nospicedham.web.de> - 2011-12-22 13:19 +0100
           Re: Fast and small Multiplicative Random number generator  hopcode <hopcode@nospicedham.nulnulul.de> - 2011-12-22 22:30 +0100
            Re: Fast and small Multiplicative Random number generator Bernhard Schornak <schornak@nospicedham.web.de> - 2011-12-23 22:59 +0100
           Re: Fast and small Multiplicative Random number generator  hopcode <hopcode@nospicedham.nulnulul.de> - 2011-12-28 02:25 +0100
            Re: Fast and small Multiplicative Random number generator Bernhard Schornak <schornak@nospicedham.web.de> - 2011-12-29 00:34 +0100
  Re: Fast and small Multiplicative Random number generator Hugh Aguilar <hughaguilar96@nospicedham.yahoo.com> - 2011-12-20 19:35 -0800
    Re: Fast and small Multiplicative Random number generator "Harold Aptroot" <harold.aptroot@nospicedham.gmail.com> - 2011-12-21 12:21 +0100
     Re: Fast and small Multiplicative Random number generator  hopcode <hopcode@nospicedham.nulnulul.de> - 2011-12-21 12:29 +0100
      Re: Fast and small Multiplicative Random number generator Hugh Aguilar <hughaguilar96@nospicedham.yahoo.com> - 2011-12-21 05:45 -0800
         Re: Fast and small Multiplicative Random number generator  hopcode <hopcode@nospicedham.nulnulul.de> - 2011-12-21 18:40 +0100
          Re: Fast and small Multiplicative Random number generator Hugh Aguilar <hughaguilar96@nospicedham.yahoo.com> - 2011-12-22 15:42 -0800
             Re: Fast and small Multiplicative Random number generator  hopcode <hopcode@nospicedham.nulnulul.de> - 2011-12-23 02:24 +0100
    Re: Fast and small Multiplicative Random number generator "Rod Pemberton" <do_not_have@nospicedham.noavailemail.cmm> - 2011-12-21 14:48 -0500
   Re: Fast and small Multiplicative Random number generator  hopcode <hopcode@nospicedham.nulnulul.de> - 2011-12-27 14:19 +0100
    Re: Fast and small Multiplicative Random number generator sfuerst <svfuerst@nospicedham.gmail.com> - 2011-12-28 14:04 -0800
       Re: Fast and small Multiplicative Random number generator  hopcode <hopcode@nospicedham.nulnulul.de> - 2011-12-29 02:13 +0100
        Re: Fast and small Multiplicative Random number generator sfuerst <svfuerst@nospicedham.gmail.com> - 2011-12-28 18:43 -0800
           Re: Fast and small Multiplicative Random number generator  hopcode <hopcode@nospicedham.nulnulul.de> - 2011-12-30 05:50 +0100
            Re: Fast and small Multiplicative Random number generator sfuerst <svfuerst@nospicedham.gmail.com> - 2011-12-29 21:31 -0800
               Re: Fast and small Multiplicative Random number generator  hopcode <hopcode@nospicedham.nulnulul.de> - 2011-12-30 08:20 +0100
                Re: Fast and small Multiplicative Random number generator sfuerst <svfuerst@nospicedham.gmail.com> - 2011-12-30 08:34 -0800
      Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2011-12-29 17:33 -0800
        Re: Fast and small Multiplicative Random number generator sfuerst <svfuerst@nospicedham.gmail.com> - 2011-12-29 20:52 -0800
        Re: Fast and small Multiplicative Random number generator Robert Wessel <robertwessel2@nospicedham.yahoo.com> - 2011-12-30 01:18 -0600
          Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2011-12-30 00:19 -0800
            Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2011-12-30 00:53 -0800
            Re: Fast and small Multiplicative Random number generator sfuerst <svfuerst@nospicedham.gmail.com> - 2011-12-30 08:30 -0800
              Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2011-12-30 17:16 -0800
                Re: Fast and small Multiplicative Random number generator sfuerst <svfuerst@nospicedham.gmail.com> - 2011-12-30 22:52 -0800
                Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2011-12-31 03:23 -0800
                Re: Fast and small Multiplicative Random number generator sfuerst <svfuerst@nospicedham.gmail.com> - 2011-12-31 08:45 -0800
                Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2012-01-02 15:21 -0800
                Re: Fast and small Multiplicative Random number generator pete@nospam.demon.co.uk - 2012-01-03 09:01 +0000
                Re: Fast and small Multiplicative Random number generator Terje Mathisen <"terje.mathisen at tmsw.no"@giganews.com> - 2012-01-03 12:57 +0100
                Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2012-01-03 10:29 -0800
                Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2012-01-03 11:03 -0800
                Re: Fast and small Multiplicative Random number generator Terje Mathisen <"terje.mathisen at tmsw.no"@giganews.com> - 2012-01-03 22:18 +0100
                Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2012-01-03 14:22 -0800
                Re: Fast and small Multiplicative Random number generator "Rod Pemberton" <do_not_have@nospicedham.noavailemail.cmm> - 2012-01-03 21:36 -0500
                Re: Fast and small Multiplicative Random number generator "Rod Pemberton" <do_not_have@nospicedham.noavailemail.cmm> - 2012-01-03 21:40 -0500
                Re: Fast and small Multiplicative Random number generator hopcode <hopcode@nospicedham.invalid.de> - 2012-01-05 04:13 +0100
                Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2012-01-05 13:28 -0800
                Re: Fast and small Multiplicative Random number generator sfuerst <svfuerst@nospicedham.gmail.com> - 2012-01-05 19:42 -0800
                Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2012-01-06 03:28 -0800
                Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2012-01-06 10:15 -0800
                Re: Fast and small Multiplicative Random number generator sfuerst <svfuerst@nospicedham.gmail.com> - 2012-01-06 11:32 -0800
                Re: Fast and small Multiplicative Random number generator sfuerst <svfuerst@nospicedham.gmail.com> - 2012-01-06 11:31 -0800
                Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2012-01-06 15:31 -0800
                Re: Fast and small Multiplicative Random number generator Frank Kotler <fbkotler@nospicedham.myfairpoint.net> - 2012-01-10 04:13 -0500
                Re: Fast and small Multiplicative Random number generator Jim Leonard <mobygamer@nospicedham.gmail.com> - 2012-01-10 09:54 -0800
                Re: Fast and small Multiplicative Random number generator sfuerst <svfuerst@nospicedham.gmail.com> - 2012-01-10 16:38 -0800
                Re: Fast and small Multiplicative Random number generator sfuerst <svfuerst@nospicedham.gmail.com> - 2012-01-10 17:21 -0800
                Re: Fast and small Multiplicative Random number generator hopcode <hopcode@nospicedham.invalid.de> - 2012-04-06 02:24 +0200
                Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2012-04-06 01:58 -0700
                Re: Fast and small Multiplicative Random number generator hopcode <hopcode@nospicedham.invalid.de> - 2012-04-06 13:55 +0200
                Re: Fast and small Multiplicative Random number generator sfuerst <svfuerst@nospicedham.gmail.com> - 2012-01-10 17:19 -0800
                Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2012-01-11 03:39 -0800
                Re: Fast and small Multiplicative Random number generator sfuerst <svfuerst@nospicedham.gmail.com> - 2012-01-11 18:28 -0800
                Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2012-01-11 03:37 -0800
                Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2012-01-11 16:59 -0800
                Re: Fast and small Multiplicative Random number generator sfuerst <svfuerst@nospicedham.gmail.com> - 2012-01-11 19:22 -0800
                Re: Fast and small Multiplicative Random number generator hopcode <marcrainer.kranz@nospicedham.yahoo.com> - 2012-01-12 03:46 +0100
                Re: Fast and small Multiplicative Random number generator sfuerst <svfuerst@nospicedham.gmail.com> - 2012-01-11 18:56 -0800
                Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2012-01-11 20:58 -0800
              Re: Fast and small Multiplicative Random number generator Phil Carmody <thefatphil_demunged@nospicedham.yahoo.co.uk> - 2012-01-04 21:23 +0200
                Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2012-01-04 14:35 -0800
  Re: Fast and small Multiplicative Random number generator Pedro Pereira <ppereira@nospicedham.grupopie.com> - 2012-01-03 19:34 +0000
    Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2012-01-03 12:59 -0800
      Re: Fast and small Multiplicative Random number generator Pedro Pereira <ppereira@nospicedham.grupopie.com> - 2012-01-04 18:57 +0000
        Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2012-01-04 13:15 -0800
          Re: Fast and small Multiplicative Random number generator Pedro Pereira <ppereira@nospicedham.grupopie.com> - 2012-01-12 18:25 +0000
            Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2012-01-12 12:04 -0800
              Re: Fast and small Multiplicative Random number generator orz <cdhorz@nospicedham.gmail.com> - 2012-01-14 02:33 -0800
                Re: Fast and small Multiplicative Random number generator Pedro Pereira <ppereira@nospicedham.grupopie.com> - 2012-01-23 19:23 +0000
        Re: Fast and small Multiplicative Random number generator hopcode <hopcode@nospicedham.invalid.de> - 2012-01-05 03:53 +0100

csiph-web