Newsgroups: sci.math, comp.lang.c, comp.lang.fortran
From: Ian Collins <ian-n...@hotmail.com>
Date: Mon, 06 Sep 2010 09:19:56 +1200
Local: Sun, Sep 5 2010 5:19 pm
Subject: Re: Implementing the KISS4691 RNG
On 09/ 6/10 09:04 AM, geo wrote:
<snip> > Thus I suggest using this listing for the MWC function > unsigned long MWC(void) > j=(j<4690)? j+1:0; This code must be making assumptions about sizes, it gives different > x=Q[j]; t=(x<<13)+c; > if(t<c) {c=(x>>19)+1; t=t+x;} > else {t=t+x; c=(x>>19)+(t<x);} > return (Q[j]=t); > } results in 32 and 64 bit mode. > ------------------------------------------------ Try compiling with warnings enabled! > and recommend that it be the pattern for implementations in > In case you do not have, or don't want to fetch, the original, > ------------------------------------------------------------ > unsigned long MWC(void) > #define CNG ( xcng=69069*xcng+123 ) > #include<stdio.h> -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||