Gmail تقويم المستندات مجموعات ويب المزيد »
المجموعات التي قمت بزيارتها مؤخرا | مساعدة | تسجيل الدخول
الصفحة الرئيسية لمجموعات Google
RNGs: A Super KISS
هناك حالياً عدة مواضيع في هذه المجموعة يتم عرضها كأول موضوع. لجعل هذا الموضوع يظهر كأول موضوع، الرجاء إزالة هذا الخيار من المواضيع اﻷخرى.
وقع خطأ في معالجة طلبك. الرجاء حاول مجددا.
تمييز
  8‏ من الرسائل - طي الكل  -  ترجمة الكل إلى اللغة نص مترجم (عرض جميع المصادر الأصلية)
المجموعة التي تقوم بالإرسال إليها هيمجموعة Usenet. الرسائل المرسلة لهذه المجموعة ستجعل بريدك مرئيًا لأي فرد على شبكة الإنترنت
لم يتم إرسال رسالة الرد حتى الآن.
تم النشر الخاص بك بنجاح
 
من:
إلى:
نسخة إلى:
استجابةً إلى:
أضف "نسخة إلى" | أضف "استجابةً إلى" | تحرير الموضوع
الموضوع:
التحقق:
لغرض التحقق من الصحة، يرجى كتابة الحروف التي تراها في الصورة أدناه أو الأرقام التي تسمعها عند النقر فوق رمز وصول ذوي الاحتياجات الخاصة. استمع وإكتب الأرقام التي تسمعها
 
user923005  
عرض ملف التعريف   ترجمة إلى اللغة نص مترجم (عرض المحتوى الأصلي)
 خيارات أكثر 3 نوفمبر, 22:23
مجموعات أخبار: sci.math, comp.lang.c, sci.crypt, comp.lang.c++
من: user923005 <dcor...@connx.com>
التاريخ: Tue, 3 Nov 2009 12:23:57 -0800 (PST)
محلّي: ‏الثلاثاء 3 نوفمبر 2009 22:23‏
الموضوع: ‏Re: RNGs: A Super KISS‏
On Nov 3, 7:46 am, geo <gmarsag...@gmail.com> wrote:

/*
Here is a C++ version.  The C version is quite a bit faster
because there are no function calls at all.
Can any of you C++ gurus bump the speed without losing encapsulation?
I get about 5 seconds for the C version and about 8 seconds for the
C++ version.

-- d.corbit
*/

#include <iostream>
/*
For those mesmerized (or Mersenne-ized?) by a RNG
with period 2^19937-1, I offer one here with period
54767*2^1337279---over 10^396564 times as long.
It is one of my CMWC (Complimentary-Multiply-With-Carry) RNGs,
and is suggested here as one of the components of a
super-long-period KISS (Keep-It-Simple-Stupid) RNG.

With b=2^32 and a=7010176, and given a 32-bit x, and a 32-bit c, this
generator produces a new x,c by forming 64-bit t=a*x+c then replacing:
c=top 32 bits of t and x=(b-1)-(bottom 32 bits of t). In C: c=t>>32;
x=~t;

For many years, CPUs have had machine instructions to form such a
64-bit t and extract the top and bottom halves, but unfortunately
only recent Fortran versions have means to easily invoke them.

Ability to do those extractions leads to implementations that are
simple
and extremely fast---some 140 million per second on my desktop PC.

Used alone, this generator passes all the Diehard Battery of Tests,
but
its simplicity makes it well-suited to serve as one of the three
components
of a KISS RNG, based on the Keep-It-Simple-Stupid principle, and the
idea,
supported by both theory and practice, that the combination of RNGs
based on
different mathematical models can be no worse---and is usually
better---than
any of the components.

So here is a complete C version of what might be called a SUPER KISS
RNG,
combining, by addition mod 2^32, a Congruential RNG, a Xorshift RNG
and the super-long-period CMWC RNG:
*/

class SuperKiss {

private:
    unsigned long  Q[41790];
    unsigned long  indx;
    unsigned long  carry;
    unsigned long  xcng;
    unsigned long  xs;

    int refill ()
    {
        int i;
        unsigned long long t;
        for (i = 0; i < 41790; i++)
        {
            t = 7010176LL * Q[i] + carry;
            carry = (t >> 32);
            Q[i] = ~(t);
        }
        indx = 1;
        return (Q[0]);
    }

public:
    // Constructor:
    SuperKiss()
    {
        indx  = 41790;
        carry = 362436;
        xcng  = 1236789;
        xs    = 521288629;
        unsigned i;
        for (i = 0; i < 41790; i++)
            Q[i] = (xcng = 69609 * xcng + 123) +
                   (xs ^= xs << 13, xs ^= (unsigned) xs >> 17, xs ^=
xs >> 5);
    }

    // Collect next random number:
    unsigned long SKRand() {
        return (indx < 41790 ? Q[indx++] : refill ()) +
               (xcng = 69609 * xcng + 123) +
               (xs ^= xs << 13, xs ^= (unsigned) xs >> 17, xs ^= xs >>
5);
    }

};

int
main ()
{
    unsigned long i
    int x;
    SuperKiss sk;
    for (i = 0; i < 1000000000; i++)
        x = sk.SKRand();
    std::cout << " x = " << x << std::endl << "does Does
x=-872412446?" << std::endl;
    return 0;

}

/*
Running this program should produce 10^9 KISSes in some 7-15 seconds.
You are invited to cut, paste, compile and run for yourself, checking
to
see if the last value is as designated, (formatted as a signed integer
for
potential comparisons with systems using signed integers).
You may want to report or comment on implementations for other
languages.

The arithmetic operations are suited for either signed or unsigned
integers.
Thus, with  (64-bit)t=a*x+c,  x=t%b in C or x=mod(t,b) in Fortran, and
c=c/b in either C or Fortran, but with ways to avoid integer
divisions,
and subsequent replacement of x by its base-b complement, ~x in C.

With b=2^32 and p=54767*2^1337287+1, the SUPR part of this Super KISS
uses my CMWC method to produce, in reverse order, the base-b expansion
of k/p for some k determined by the values used to seed the Q array.
The period is the order of b for that prime p:
54767*2^1337279, about 2^1337294 or 10^402566.
(It took a continuous run of 24+ days on an earlier PC to
establish that order.  My thanks to the wizards behind PFGW
and to Phil Carmody for some suggested code.)

Even the Q's all zero, should seeding be overlooked in main(),
will still produce a sequence of the required period, but will
put the user in a strange and exceedingly rare place in the entire
sequence.  Users should choose a reasonable number of the 1337280
random bits that a fully-seeded  Q array requires.

Using your own choices of merely 87 seed bits, 32 each for xcng,xs
and 23 for carry<7010176, then initializing the Q array with
for(i=0;i<41790;i++) Q[i]=CNG+XS;
should serve well for many applications, but others, such as in
Law or Gaming, where a minimum number of possible outcomes may be
required, might need more of the 1337280 seed bits for the Q array.

As might applications in cryptography: With an unknown but fully-
seeded Q array, a particular string of, say, 41000 successive SUPR
values will appear at more than 2^20000 locations in the full
sequence,
making it virtually impossible to get the location of that particular
string in the full loop, and thus predict coming or earlier values,
even
...

اقرأ المزيد »


يجب تسجيل الدخول قبل إرسال رسائلك.
لنشر رسالة يجب أولاً أن تنضم إلى هذه المجموعة.
يرجى تحديث اسم الشهرة الخاص بك على صفحة إعدادات الاشتراك قبل النشر.
لا يوجد لديك الإذن المطلوب للنشر.
user923005  
عرض ملف التعريف   ترجمة إلى اللغة نص مترجم (عرض المحتوى الأصلي)
 خيارات أكثر 3 نوفمبر, 22:36
مجموعات أخبار: sci.math, comp.lang.c, sci.crypt, comp.lang.c++
من: user923005 <dcor...@connx.com>
التاريخ: Tue, 3 Nov 2009 12:36:15 -0800 (PST)
محلّي: ‏الثلاثاء 3 نوفمبر 2009 22:36‏
الموضوع: ‏Re: RNGs: A Super KISS‏
On Nov 3, 12:23 pm, user923005 <dcor...@connx.com> wrote:
I copied and pasted from the wrong file.  Here is the correct code
[snip]
class SuperKiss {

private:
    unsigned long  Q[41790];
    unsigned long  indx;
    unsigned long  carry;
    unsigned long  xcng;
    unsigned long  xs;

    int refill ()
    {
        int i;
        unsigned long long t;
        for (i = 0; i < 41790; i++)
        {
            t = 7010176LL * Q[i] + carry;
            carry = (t >> 32);
            Q[i] = ~(t);
        }
        indx = 1;
        return (Q[0]);
    }

public:
    // Constructor:
    SuperKiss()
    {
        indx  = 41790;
        carry = 362436;
        xcng  = 1236789;
        xs    = 521288629;
        unsigned i;
        for (i = 0; i < 41790; i++)
            Q[i] = (xcng = 69609 * xcng + 123) +
                   (xs ^= xs << 13, xs ^= (unsigned) xs >> 17, xs ^=
xs >> 5);
    }

    // Collect next random number:
    unsigned long SKRand() {
        return (indx < 41790 ? Q[indx++] : refill ()) +
               (xcng = 69609 * xcng + 123) +
               (xs ^= xs << 13, xs ^= (unsigned) xs >> 17, xs ^= xs >>
5);
    }

};

int
main ()
{
    unsigned long i;
    int x=0;
    SuperKiss sk;
    for (i = 0; i < 1000000000; i++)
        x = sk.SKRand();
    std::cout << "   x = " << x << std::endl << "Does x=-872412446?"
<< std::endl;
    return 0;


يجب تسجيل الدخول قبل إرسال رسائلك.
لنشر رسالة يجب أولاً أن تنضم إلى هذه المجموعة.
يرجى تحديث اسم الشهرة الخاص بك على صفحة إعدادات الاشتراك قبل النشر.
لا يوجد لديك الإذن المطلوب للنشر.
user923005  
عرض ملف التعريف   ترجمة إلى اللغة نص مترجم (عرض المحتوى الأصلي)
 خيارات أكثر 4 نوفمبر, 23:31
مجموعات أخبار: sci.math, comp.lang.c, sci.crypt, comp.lang.c++
من: user923005 <dcor...@connx.com>
التاريخ: Wed, 4 Nov 2009 13:31:20 -0800 (PST)
محلّي: ‏الأربعاء 4 نوفمبر 2009 23:31‏
الموضوع: ‏Re: RNGs: A Super KISS‏
On Nov 4, 1:26 pm, user923005 <dcor...@connx.com> wrote:

> On Nov 4, 9:18 am, David <david.astgt...@gmail.com> wrote:

> > On an x86-64 machine using GCC version 4.3.3 (Ubuntu 4.3.3-5ubuntu4),
> > both the C code and C++ code fail for me.
> > I get:
> >      x=505478909.
> > Does x=-872412446?

> > Changing the unsigned long's to unsigned int's fixed the problem.
> > And it does matter: before the change, the generator failed a variety
> > of tests (really odd assortment, though: parking lot, 2dsphere,
> > 3dsphere, squeeze, and sums).

> OK, makes sense.  The RNG must assume 32 bit longs.

Modified C++ code:

#include <iostream>

class SuperKiss {

private:
    unsigned int  Q[41790];
    unsigned int  indx;
    unsigned int  carry;
    unsigned int  xcng;
    unsigned int  xs;

    int refill ()
    {
        int i;
        unsigned long long t;
        for (i = 0; i < 41790; i++)
        {
            t = 7010176LL * Q[i] + carry;
            carry = (t >> 32);
            Q[i] =(unsigned int) ~(t);
        }
        indx = 1;
        return (Q[0]);
    }

public:
    // Constructor:
    SuperKiss()
    {
        indx  = 41790;
        carry = 362436;
        xcng  = 1236789;
        xs    = 521288629;
        unsigned i;
        for (i = 0; i < 41790; i++)
            Q[i] = (xcng = 69609 * xcng + 123) +
                   (xs ^= xs << 13, xs ^= (unsigned) xs >> 17, xs ^=
xs >> 5);
    }

    // Collect next random number:
    unsigned int SKRand() {
        return (indx < 41790 ? Q[indx++] : refill ()) +
               (xcng = 69609 * xcng + 123) +
               (xs ^= xs << 13, xs ^= (unsigned) xs >> 17, xs ^= xs >>
5);
    }

};

int
main ()
{
    unsigned int i;
    int x=0;
    SuperKiss sk;
    for (i = 0; i < 1000000000; i++)
        x = sk.SKRand();
    std::cout << "   x = " << x << std::endl << "Does x=-872412446?"
<< std::endl;
    return 0;

}

/* Possible output:
   x = -872412446
Does x=-872412446?
*/

يجب تسجيل الدخول قبل إرسال رسائلك.
لنشر رسالة يجب أولاً أن تنضم إلى هذه المجموعة.
يرجى تحديث اسم الشهرة الخاص بك على صفحة إعدادات الاشتراك قبل النشر.
لا يوجد لديك الإذن المطلوب للنشر.
Victor Bazarov  
عرض ملف التعريف   ترجمة إلى اللغة نص مترجم (عرض المحتوى الأصلي)
 خيارات أكثر 4 نوفمبر, 23:51
مجموعات أخبار: comp.lang.c++
من: Victor Bazarov <v.Abaza...@comAcast.net>
التاريخ: Wed, 04 Nov 2009 16:51:53 -0500
محلّي: ‏الأربعاء 4 نوفمبر 2009 23:51‏
الموضوع: ‏Re: RNGs: A Super KISS‏

user923005 wrote:
> [..]
> Modified C++ code:

Can be actually made closer to C++, if you initialize variables instead
of declaring and assigning, etc.

BTW, currently there is no 'long long' in C++...  Although it is offered
as an extension by some compilers.

>         for (i = 0; i < 41790; i++)
>         {
>             t = 7010176LL * Q[i] + carry;

And neither is there the 'LL' suffix...

There seems to be a common subexpression in two of those functions (ctor
and 'SKRand'), I'd create a separate function for it.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask

يجب تسجيل الدخول قبل إرسال رسائلك.
لنشر رسالة يجب أولاً أن تنضم إلى هذه المجموعة.
يرجى تحديث اسم الشهرة الخاص بك على صفحة إعدادات الاشتراك قبل النشر.
لا يوجد لديك الإذن المطلوب للنشر.
Michael Doubez  
عرض ملف التعريف   ترجمة إلى اللغة نص مترجم (عرض المحتوى الأصلي)
 خيارات أكثر 5 نوفمبر, 17:21
مجموعات أخبار: comp.lang.c++
من: Michael Doubez <michael.dou...@free.fr>
التاريخ: Thu, 5 Nov 2009 07:21:30 -0800 (PST)
محلّي: ‏الخميس 5 نوفمبر 2009 17:21‏
الموضوع: ‏Re: RNGs: A Super KISS‏
On 4 nov, 22:51, Victor Bazarov <v.Abaza...@comAcast.net> wrote:

And they rely on the same state, I would create a generator class but
I don't know if that would improve the speed.

struct SuperKissGenerator
{
    unsigned long  xcng;
    unsigned long  xs;

    SuperKissGenerator():xcng(1236789),xs(521288629){}

    unsigned long operator()()const
    {
     xcng = 69609 * xcng + 123;
     xs ^= xs << 13;
     xs ^= (unsigned) xs >> 17;
     xs ^= xs >> 5;
     return xcng + xs;
    }

};

And then a member
SuperKissGenerator generator;

in constructor:
std::generate(Q,Q+41790,generator);

in SKRand:
return (indx < 41790 ? Q[indx++] : refill ()) + generator();

--
Michael


يجب تسجيل الدخول قبل إرسال رسائلك.
لنشر رسالة يجب أولاً أن تنضم إلى هذه المجموعة.
يرجى تحديث اسم الشهرة الخاص بك على صفحة إعدادات الاشتراك قبل النشر.
لا يوجد لديك الإذن المطلوب للنشر.
io_x  
عرض ملف التعريف   ترجمة إلى اللغة نص مترجم (عرض المحتوى الأصلي)
 خيارات أكثر 6 نوفمبر, 11:13
مجموعات أخبار: comp.lang.c, comp.lang.c++
من: "io_x" <a...@b.c.invalid>
التاريخ: Fri, 6 Nov 2009 10:13:18 +0100
محلّي: ‏الجمعة 6 نوفمبر 2009 11:13‏
الموضوع: ‏Re: RNGs: A Super KISS‏

"user923005" <dcor...@connx.com> ha scritto nel messaggio
news:1e22f0b0-01f3-4be4-8a5a-ce39bf86dc70@y28g2000prd.googlegroups.com...
On Nov 3, 12:23 pm, user923005 <dcor...@connx.com> wrote:

>I copied and pasted from the wrong file.  Here is the correct code
>[snip]
>class SuperKiss {

this how i see it 1:
but it is not much portable (cpu x86, assembler nasm, c++ compiler borland)
then don't know if it is right
what about this?
--xx
Delta=20.000
     i=-872412446
Does i=-872412446?
val u32    =279941939
val double =0.600837
val u32    =1357108688
val i32 -10309 +309 =-6962
val d   -10309 +309 =-695.931958
--xx
#include <stdio.h>
#include <stdint.h>
#include <time.h>

#define  u32   uint32_t
#define  i32   int32_t
#define  R  return
#define  P  printf
#define  F  for

class SuperKiss {
public:
  SuperKiss();        /* def constructor */
  u32  SKRand(void);  /* def function    */
  u32  urnd(void){R          SKRand(); }
  i32  irnd(void){R    (i32) SKRand(); }
  u32  urnd(u32  umin, u32  umax)
  {if(umin>=umax) R  0;
   R  umin+SKRand()%(umax-umin+1);
  }
  i32  irnd(i32  imin, i32  imax)
  {if(imin>=imax) R  0;
   R  imin+SKRand()%(imax-imin+1);
  }
  double  drnd(void){R (double)SKRand()/0xFFFFFFFF;}
  double  drnd(double  dmin,  double  dmax)
  {if(dmin>=dmax)  R  0.0;
   R  dmin + (dmax-dmin)*drnd();
  }

};

int main(void)
{double          d;
 time_t      ti,tf;
 SuperKiss   sk, w;
 i32             i;
 u32          u, v;

 ti=time(0);
 for(v=0; v<1000000000; ++v)
           i=sk.irnd();
 tf=time(0);
 P("Delta=%.3f\n",  (double)difftime(tf, ti));
 P(  "     i=%d",   (int) i);
 P("\nDoes i=-872412446?\n");
 P(   "val u32    =%u \n", (unsigned) w.urnd());
 P(   "val double =%f \n",  w.drnd());
 P(   "val u32    =%u \n", (unsigned) w.urnd());
 P(   "val i32 -10309 +309 =%i \n", (int) w.irnd(-10309, 309));
 P(   "val d   -10309 +309 =%f \n",       w.drnd(-10309, 309));
 R  0;

}

-------------------------
section _DATA use32 public class=DATA
global @SuperKiss@$bctr$qv
global @SuperKiss@SKRand$qv

init dd 0
indx dd 41790
carry dd 362436
xcng dd 1236789
xs dd 521288629

section _BSS use32 public class=BSS

vettoreQ resd 41792

section _TEXT use32 public class=CODE

          align   4
@SuperKiss@$bctr$qv: ; constructor
          push    esi
          push    edi
          push    ebp
          cmp     dword[init],  0
          jne     .1
          mov     ecx,  41790
          mov     esi,  vettoreQ
          mov     edi,  [xcng]
          mov     ebp,  [xs]
.0:       mov     eax,  69609
          mul     edi
          add     eax,  123
          xchg    eax,  edi
          mov     eax,  ebp
          shl     eax,  13
          xor     ebp,  eax
          mov     eax,  ebp
          shr     eax,  17
          xor     ebp,  eax
          mov     eax,  ebp
          shr     eax,  5
          xor     ebp,  eax
          lea     eax,  [ebp+edi]
          mov     [esi],  eax
          add     esi,  4
          loop    .0
          mov     [xcng],  edi
          mov     [xs],  ebp
          mov     dword[init],  1
.1:
          pop     ebp
          pop     edi
          pop     esi
          ret

          align   4
ini:
          mov     esi,  vettoreQ
.0:       mov     eax,  7010176
          mul     dword[esi]
          add     eax,  [carry]
          adc     edx,  0
          mov     [carry],  edx
          not     eax
          mov     dword[esi],  eax
          add     esi,  4
          loop    .0
          jmp     short  @SuperKiss@SKRand$qv.1

          align   4
@SuperKiss@SKRand$qv:
          push    esi
          mov     ecx,  [indx]
          cmp     ecx,  41790
          je      ini
.1:       mov     esi,  [vettoreQ+4*ecx]
          mov     edx,  [xs]
          inc     ecx
          mov     eax,  edx
          mov     [indx],  ecx
          shl     eax,  13
          imul    ecx,  [xcng],  69609
          xor     edx,  eax
          add     ecx,  123
          mov     eax,  edx
          mov     [xcng],  ecx
          shr     eax,  17
          add     esi,  ecx
          xor     edx,  eax
          mov     eax,  edx
          shr     eax,  5
          xor     edx,  eax
          mov     [xs],  edx
          lea     eax,  [esi+edx]
          pop     esi
          ret


يجب تسجيل الدخول قبل إرسال رسائلك.
لنشر رسالة يجب أولاً أن تنضم إلى هذه المجموعة.
يرجى تحديث اسم الشهرة الخاص بك على صفحة إعدادات الاشتراك قبل النشر.
لا يوجد لديك الإذن المطلوب للنشر.
io_x  
عرض ملف التعريف   ترجمة إلى اللغة نص مترجم (عرض المحتوى الأصلي)
 خيارات أكثر 6 نوفمبر, 11:13
مجموعات أخبار: comp.lang.c, comp.lang.c++
من: "io_x" <a...@b.c.invalid>
التاريخ: Fri, 6 Nov 2009 10:13:31 +0100
محلّي: ‏الجمعة 6 نوفمبر 2009 11:13‏
الموضوع: ‏Re: RNGs: A Super KISS‏

"user923005" <dcor...@connx.com> ha scritto nel messaggio
news:1e22f0b0-01f3-4be4-8a5a-ce39bf86dc70@y28g2000prd.googlegroups.com...
On Nov 3, 12:23 pm, user923005 <dcor...@connx.com> wrote:

>I copied and pasted from the wrong file.  Here is the correct code
>[snip]
>class SuperKiss {

this is how i see it 2:
but it is not much portable (cpu x86, assembler nasm, c++ compiler borland)
then don't know if it is right...
what about this?
----x
Delta=23.000
     i=-872412446
Does i=-872412446?
val u32    =3075790285
val double =0.647830
val u32    =4289339058
val i32 -10309 +309 =-6324
val d   -10309 +309 =-6716.981099
---x
#include <stdio.h>
#include <stdint.h>
#include <time.h>
#include <stdlib.h>

#define  u32   uint32_t
#define  i32   int32_t
#define  R  return
#define  P  printf
#define  F  for

class SuperKiss{
public:
  SuperKiss(u32, u32, u32);  /* def costructor */
 ~SuperKiss(){ free(q); }
  u32   SKRand(void);        /* def function   */
  u32  urnd(void){R          SKRand(); }
  i32  irnd(void){R    (i32) SKRand(); }
  u32  urnd(u32  umin, u32  umax)
  {if(umin>=umax) R  0;
   R  umin+SKRand()%(umax-umin+1);
  }
  i32  irnd(i32  imin, i32  imax)
  {if(imin>=imax) R  0;
   R  imin+SKRand()%(imax-imin+1);
  }
  double  drnd(void){R (double)SKRand()/0xFFFFFFFF;}
  double  drnd(double  dmin,  double  dmax)
  {if(dmin>=dmax)  R  0.0;
   R  dmin + (dmax-dmin)*drnd();
  }
u32*    q;
u32  indx;
u32 carry;
u32  xcng;
u32    xs;

};

void  initialize(SuperKiss*  m);

SuperKiss::SuperKiss(u32 xcarry=362436, u32 xxcng=1236789, u32 xxs=521288629)
{u32  *v;
 q=0; indx=0;
 v=(u32*)malloc(41792* sizeof(u32));
 if(v==0)  R;
 q=v; indx=41790; carry=xcarry; xcng=xxcng; xs=xxs;
 initialize(this);

}

int main(void)
{double          d;
 time_t      ti,tf;
 SuperKiss   sk, w;
 i32             i;
 u32          u, v;

 if(sk.q==0||w.q==0)
   {P("Too Few memory\n"); R  1;}
 ti=time(0);
 for(v=0; v<1000000000; ++v)
           i=sk.irnd();
 tf=time(0);
 P("Delta=%.3f\n",  (double)difftime(tf, ti));
 P(  "     i=%d",   (int) i);
 P("\nDoes i=-872412446?\n");
 P(   "val u32    =%u \n", (unsigned) w.urnd());
 P(   "val double =%f \n",  w.drnd());
 P(   "val u32    =%u \n", (unsigned) w.urnd());
 P(   "val i32 -10309 +309 =%i \n", (int) w.irnd(-10309, 309));
 P(   "val d   -10309 +309 =%f \n",       w.drnd(-10309, 309));
 R  0;

}

-------------------
section _DATA use32 public class=DATA
global @initialize$qp9SuperKiss
global @SuperKiss@SKRand$qv

section _TEXT use32 public class=CODE

; 0q, 4indx, 8carry, 12xcng, 16xs
; 0k, 4j, 8i, 12ra, 16P
          align   4
@initialize$qp9SuperKiss:
          push    esi
          push    edi
          push    ebp
          mov     ecx,  41790
          mov     edx,  dword[esp+  16]
          mov     esi,  [edx]
          mov     edi,  [edx+12]
          mov     ebp,  [edx+16]
.0:       mov     eax,  69609
          mul     edi
          add     eax,  123
          xchg    eax,  edi
          mov     eax,  ebp
          shl     eax,  13
          xor     ebp,  eax
          mov     eax,  ebp
          shr     eax,  17
          xor     ebp,  eax
          mov     eax,  ebp
          shr     eax,  5
          xor     ebp,  eax
          lea     eax,  [ebp+edi]
          mov     [esi],  eax
          add     esi,  4
          loop    .0
          mov     edx,  dword[esp+  16]
          mov     [edx+12],  edi
          mov     [edx+16],  ebp
.1:
          pop     ebp
          pop     edi
          pop     esi
          ret

          align   4
ini:
          mov     esi,  [edi]
.0:       mov     eax,  7010176
          mul     dword[esi]
          add     eax,  [edi+8]
          adc     edx,  0
          mov     [edi+8],  edx
          not     eax
          mov     dword[esi],  eax
          add     esi,  4
          loop    .0
          jmp     short  @SuperKiss@SKRand$qv.1

; 0j, 4i, 8ra, 12P
          align   4
@SuperKiss@SKRand$qv:
          push    esi
          push    edi
          mov     edi,  dword[esp+  12]
          mov     ecx,  [edi+4]
          cmp     ecx,  41790
          je      ini
.1:       mov     esi,  [edi]
          mov     esi,  [esi+4*ecx]
          mov     edx,  [edi+16]
          inc     ecx
          mov     eax,  edx
          mov     [edi+4],  ecx
          shl     eax,  13
          imul    ecx,  [edi+12],  69609
          xor     edx,  eax
          add     ecx,  123
          mov     eax,  edx
          mov     [edi+12],  ecx
          shr     eax,  17
          add     esi,  ecx
          xor     edx,  eax
          mov     eax,  edx
          shr     eax,  5
          xor     edx,  eax
          mov     [edi+16],  edx
          lea     eax,  [esi+edx]
          pop     edi
          pop     esi
          ret


يجب تسجيل الدخول قبل إرسال رسائلك.
لنشر رسالة يجب أولاً أن تنضم إلى هذه المجموعة.
يرجى تحديث اسم الشهرة الخاص بك على صفحة إعدادات الاشتراك قبل النشر.
لا يوجد لديك الإذن المطلوب للنشر.
io_x  
عرض ملف التعريف   ترجمة إلى اللغة نص مترجم (عرض المحتوى الأصلي)
 خيارات أكثر 8 نوفمبر, 20:59
مجموعات أخبار: comp.lang.c, comp.lang.c++
من: "io_x" <a...@b.c.invalid>
التاريخ: Sun, 8 Nov 2009 19:59:58 +0100
محلّي: ‏الأحد 8 نوفمبر 2009 20:59‏
الموضوع: ‏Re: RNGs: A Super KISS‏
"io_x" <a...@b.c.invalid> ha scritto nel messaggio
news:4af3e70f$0$1104$4fafbaef@reader1.news.tin.it...

> class SuperKiss {
> public:
>  SuperKiss();        /* def constructor */
>  u32  SKRand(void);  /* def function    */

not define, better declare

يجب تسجيل الدخول قبل إرسال رسائلك.
لنشر رسالة يجب أولاً أن تنضم إلى هذه المجموعة.
يرجى تحديث اسم الشهرة الخاص بك على صفحة إعدادات الاشتراك قبل النشر.
لا يوجد لديك الإذن المطلوب للنشر.
نهاية الرسائل
« الرجوع إلى المناقشات « موضوع أحدث     موضوع أقدم »

إنشاء مجموعة - مجموعات Google - صفحة Google الرئيسية - شروط الخدمة - سياسة الخصوصية
©2009 Google