• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ RND函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中RND函数的典型用法代码示例。如果您正苦于以下问题:C++ RND函数的具体用法?C++ RND怎么用?C++ RND使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了RND函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: HomedGhost

static void HomedGhost(GAME_STATE *ptr, G_GHOST *pGhost)
{
char c;

	switch(pGhost->iInHome)
		{
		case GIH_SHUFFLE:
				/* Move up into gateway?? */
				if (RND(2) == 0 && Pac_GetMap(ptr,pGhost->Pos.x,pGhost->Pos.y-1,&c) && c=='-')
					{
					pGhost->iInHome = GIH_GATEWAY;
					pGhost->Pos.y--;
					}
				else
					{
					c = RND(3);
					if (c == 0 && Pac_GetMap(ptr,pGhost->Pos.x-1,pGhost->Pos.y,&c) && c=='H')
						pGhost->Pos.x--;
					else if (c == 1 && Pac_GetMap(ptr,pGhost->Pos.x+1,pGhost->Pos.y,&c) && c=='H')
						pGhost->Pos.x++;
					}
				break;
		case GIH_GATEWAY:
				pGhost->Pos.y--; /* ASSUME: gate opens upwards */
				pGhost->iInHome = GIH_OUTSIDE;
				if (RND(2) == 0)
					pGhost->Direction = eDIR_Left;
				else
					pGhost->Direction = eDIR_Right;
				break;
		}
}
开发者ID:Alexandre251313,项目名称:pacman,代码行数:32,代码来源:ghosts.c


示例2: rc6_ecb_encrypt

int rc6_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey)
#endif
{
   ulong32 a,b,c,d,t,u, *K;
   int r;
   
   LTC_ARGCHK(skey != NULL);
   LTC_ARGCHK(pt   != NULL);
   LTC_ARGCHK(ct   != NULL);
   LOAD32L(a,&pt[0]);LOAD32L(b,&pt[4]);LOAD32L(c,&pt[8]);LOAD32L(d,&pt[12]);

   b += skey->rc6.K[0];
   d += skey->rc6.K[1];

#define RND(a,b,c,d) \
       t = (b * (b + b + 1)); t = ROLc(t, 5); \
       u = (d * (d + d + 1)); u = ROLc(u, 5); \
       a = ROL(a^t,u) + K[0];                \
       c = ROL(c^u,t) + K[1]; K += 2;   
    
   K = skey->rc6.K + 2;
   for (r = 0; r < 20; r += 4) {
       RND(a,b,c,d);
       RND(b,c,d,a);
       RND(c,d,a,b);
       RND(d,a,b,c);
   }
   
#undef RND

   a += skey->rc6.K[42];
   c += skey->rc6.K[43];
   STORE32L(a,&ct[0]);STORE32L(b,&ct[4]);STORE32L(c,&ct[8]);STORE32L(d,&ct[12]);
   return CRYPT_OK;
}
开发者ID:jamesyan84,项目名称:mt36k_android_4.0.4,代码行数:35,代码来源:rc6.c


示例3: rc6_ecb_decrypt

void rc6_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey)
#endif
{
   ulong32 a,b,c,d,t,u, *K;
   int r;

   LTC_ARGCHK(skey != NULL);
   LTC_ARGCHK(pt   != NULL);
   LTC_ARGCHK(ct   != NULL);
   
   LOAD32L(a,&ct[0]);LOAD32L(b,&ct[4]);LOAD32L(c,&ct[8]);LOAD32L(d,&ct[12]);
   a -= skey->rc6.K[42];
   c -= skey->rc6.K[43];
   
#define RND(a,b,c,d) \
       t = (b * (b + b + 1)); t = ROLc(t, 5); \
       u = (d * (d + d + 1)); u = ROLc(u, 5); \
       c = ROR(c - K[1], t) ^ u; \
       a = ROR(a - K[0], u) ^ t; K -= 2;
   
   K = skey->rc6.K + 40;
   
   for (r = 0; r < 20; r += 4) {
       RND(d,a,b,c);
       RND(c,d,a,b);
       RND(b,c,d,a);
       RND(a,b,c,d);
   }
   
#undef RND

   b -= skey->rc6.K[0];
   d -= skey->rc6.K[1];
   STORE32L(a,&pt[0]);STORE32L(b,&pt[4]);STORE32L(c,&pt[8]);STORE32L(d,&pt[12]);
}
开发者ID:tch-opensrc,项目名称:TC72XX_LxG1.7.1mp1_OpenSrc,代码行数:35,代码来源:rc6.c


示例4: MoveGhost

static void MoveGhost(GAME_STATE *ptr, G_GHOST *pGhost)
{
int tries=0;

	if (!IsNextMoveValid(ptr, pGhost))
		{ /* must be either 1 or 2 valid directions */
		tDir w1,w2;

		switch(pGhost->Direction) 
			{
			case eDIR_Right:
			case eDIR_Left:	w1=eDIR_Up, w2=eDIR_Down; break;
			case eDIR_Up:
			case eDIR_Down:	w1=eDIR_Left, w2=eDIR_Right; break;
			}
		if (RND(2)==0)	/* try w1 first, then w2 */
			{
			pGhost->Direction = w1;
			if (!IsNextMoveValid(ptr, pGhost))
				pGhost->Direction = w2;
			}
		else
			{
			pGhost->Direction = w2;
			if (!IsNextMoveValid(ptr, pGhost))
				pGhost->Direction = w1;
			}
		}

	if (RND(34) == 0 && pGhost->Pos.x != ptr->Player.Pos.x && pGhost->Pos.y != ptr->Player.Pos.y)
		{
		pGhost->Direction = RND(4);	/* a little bit bad! */
		while(++tries < 4)
			{
			if (IsNextMoveValid(ptr, pGhost))
				break;/* found a new dir */
			else
				if (++pGhost->Direction == 4)
					pGhost->Direction = 0;
			}
		}

	/* Move the ghost */
	switch(pGhost->Direction)
		{
		case eDIR_Left:		pGhost->Pos.x--; break;
		case eDIR_Right:	pGhost->Pos.x++; break;
		case eDIR_Up:		pGhost->Pos.y--; break;
		case eDIR_Down:		pGhost->Pos.y++; break;
		}
	/* Check for tunnel */
	if (pGhost->Pos.x < 0)	pGhost->Pos.x = ptr->iMapWidth-1;
	if (pGhost->Pos.x >= ptr->iMapWidth) pGhost->Pos.x = 0;
}
开发者ID:Alexandre251313,项目名称:pacman,代码行数:54,代码来源:ghosts.c


示例5: calc_entropy

void calc_entropy (
  MODEL *model,			/* the model */
  DATASET *dataset  		/* the dataset */
)
{
  int i, j;
  double *rentropy = model->rentropy;		/* IC of each column */
  double ent = 0;				/* entropy per column */
  double rel = 0;				/* relative entropy per col. */
  int alength = dataset->alength;		/* length of alphabet */
  double *back = dataset->back;			/* background model freqs */
  THETA obs = model->obs;			/* observed frequencies */
  int w = model->w;				/* width of motif */
  int N = model->nsites_dis;			/* number of sites */
  double log_pop;				/* log product of col p-value */
  double max_ic = LOG(alength)/LOG(2);		// maximum IC per column
  //double e = (alength-1) / (2 * LOG(2) * N);	// small sample correction
  double ic = 0;				// "corrected" IC

  /* calculate the relative entropy of each column in motif */
  model->llr = log_pop = 0;
  for (i=0; i<w; i++) {			/* position */
    double llr;				/* log likelihood ratio of column */
    rentropy[i] = 0.0; 
    double H = 0;			// negative entropy in this column
    for (j=0; j<alength; j++) {		/* alphabet letter */
      double f = obs(i, j);		/* motif freq */
      double p = back[j];		/* background freq */
      double h = f ? f * LOG2(f) : 0;	// entropy of current letter
      rel += p ? f * LOG2(p) : 0;	/* total relative entropy */
      ent += h;				/* total entropy */
      H += -h;				// negative entropy in this column
      rentropy[i] += (f && p) ? f * LOG(f/p) : 0;
    } /* alphabet letter */
    llr = N * rentropy[i];		/* log likelihood ratio */
    RND(llr, RNDDIG, llr);		/* round to RNDDIG places */
    model->llr += llr;                  /* llr for model */
    log_pop += get_llr_pv(llr, N, 1, LLR_RANGE, 1.0, alength, back);
    rentropy[i] /= LOG(2);
    // ic += MAX(0, (max_ic - (H + e)));
    ic += max_ic - H;
  } /* position in motif */

  /* compute the log E-value of the motif */
  model->logev = get_log_sig(-log_pop, model->mtype, w, N, N, model->invcomp,
    model->pal, dataset);

  model->rel = (ent - rel)/w;		/* compute rel. entropy/col */

  // LOGO total information content
  RND(ic, RNDDIG, ic);			// round to RNDDIG places
  model->ic = ic;

} /* calc_entropy */
开发者ID:BioinformaticsArchive,项目名称:EXTREME,代码行数:54,代码来源:likelihood.c


示例6: are

/* This a helper function that generates a random password with a
   number of characters from a set of character classes.

   If there are n classes, and the size of each class is Pi, and the
   number of characters from each class is Ni, the number of possible
   passwords are (given that the character classes are disjoint):

     n             n
   -----        /  ----  \
   |   |  Ni    |  \     |
   |   | Pi     |   \  Ni| !
   |   | ---- * |   /    |
   |   | Ni!    |  /___  |
    i=1          \  i=1  /

    Since it uses the RND function above, neither the size of each
    class, nor the total length of the generated password should be
    larger than 127 (without fixing RND).

   */
static void
generate_password(char **pw, int num_classes, ...)
{
    struct {
        const char *str;
        int len;
        int freq;
    } *classes;
    va_list ap;
    int len, i;
    unsigned char rbuf[8]; /* random buffer */
    int rleft = 0;

    *pw = NULL;

    classes = malloc(num_classes * sizeof(*classes));
    if(classes == NULL)
        return;
    va_start(ap, num_classes);
    len = 0;
    for(i = 0; i < num_classes; i++) {
        classes[i].str = va_arg(ap, const char*);
        classes[i].len = strlen(classes[i].str);
        classes[i].freq = va_arg(ap, int);
        len += classes[i].freq;
    }
    va_end(ap);
    *pw = malloc(len + 1);
    if(*pw == NULL) {
        free(classes);
        return;
    }
    for(i = 0; i < len; i++) {
        int j;
        int x = RND(rbuf, sizeof(rbuf), &rleft) % (len - i);
        int t = 0;
        for(j = 0; j < num_classes; j++) {
            if(x < t + classes[j].freq) {
                (*pw)[i] = classes[j].str[RND(rbuf, sizeof(rbuf), &rleft)
                                          % classes[j].len];
                classes[j].freq--;
                break;
            }
            t += classes[j].freq;
        }
    }
    (*pw)[len] = '\0';
    memset(rbuf, 0, sizeof(rbuf));
    free(classes);
}
开发者ID:cyrilmagsuci,项目名称:freebsd,代码行数:70,代码来源:random_password.c


示例7: Transform

static void Transform(Sha256* sha256)
{
    word32 S[8], W[64], t0, t1;
    int i;

    /* Copy context->state[] to working vars */
    for (i = 0; i < 8; i++)
        S[i] = sha256->digest[i];

    for (i = 0; i < 16; i++)
        W[i] = sha256->buffer[i];

    for (i = 16; i < 64; i++)
        W[i] = Gamma1(W[i-2]) + W[i-7] + Gamma0(W[i-15]) + W[i-16];

    for (i = 0; i < 64; i += 8) {
        RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],i+0);
        RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],i+1);
        RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],i+2);
        RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],i+3);
        RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],i+4);
        RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],i+5);
        RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],i+6);
        RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],i+7);
    }

    /* Add the working vars back into digest state[] */
    for (i = 0; i < 8; i++) {
        sha256->digest[i] += S[i];
    }
}
开发者ID:Plemling138,项目名称:Twitter4C,代码行数:31,代码来源:sha256.c


示例8: sha512_compress

void  sha512_compress(psDigestContext_t * md, unsigned char *buf)
#endif
{
	uint64 S[8], W[80], t0, t1;
    int i;

    /* copy state into S */
    for (i = 0; i < 8; i++) {
        S[i] = md->sha512.state[i];
    }

    /* copy the state into 1024-bits into W[0..15] */
    for (i = 0; i < 16; i++) {
		LOAD64H(W[i], buf + (8*i));
    }

    /* fill W[16..79] */
    for (i = 16; i < 80; i++) {
        W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16];
    }        

    /* Compress */
#ifndef PS_SHA512_IMPROVE_PERF_INCREASE_CODESIZE
    for (i = 0; i < 80; i++) {
        t0 = S[7] + Sigma1(S[4]) + Ch(S[4], S[5], S[6]) + K[i] + W[i];
		t1 = Sigma0(S[0]) + Maj(S[0], S[1], S[2]);
        S[7] = S[6];
        S[6] = S[5];
        S[5] = S[4];
        S[4] = S[3] + t0;
        S[3] = S[2];
        S[2] = S[1];
        S[1] = S[0];
        S[0] = t0 + t1;
    }
#else
#define RND(a,b,c,d,e,f,g,h,i)                    \
     t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i];   \
     t1 = Sigma0(a) + Maj(a, b, c);                  \
     d += t0;                                        \
     h  = t0 + t1;

     for (i = 0; i < 80; i += 8) {
         RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],i+0);
         RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],i+1);
         RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],i+2);
         RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],i+3);
         RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],i+4);
         RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],i+5);
         RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],i+6);
         RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],i+7);
     }
#endif /* PS_SHA512_IMPROVE_PERF_INCREASE_CODESIZE */

	/* feedback */
	for (i = 0; i < 8; i++) {
        md->sha512.state[i] = md->sha512.state[i] + S[i];
    }
}
开发者ID:sdhczw,项目名称:winnermicro,代码行数:59,代码来源:sha512.c


示例9: tryInsert

int tryInsert()
{
  double testx, testy;
  testx=RND()*L;
  testy=RND()*L;
  if (Pinsert(testx, testy))
  {
    X[n]=testx;
    Y[n]=testy;
    printf("%d:  inserted at %lf, %lf\n",n, testx,testy);
    n++;
    return 1;
  }
  else return 0;
}
开发者ID:frankwillmore,项目名称:ftw-codebase,代码行数:15,代码来源:working.circles.c


示例10: memcpy

static Header *compact(MemBlk *mb) 
{ 
	char *end = (char *) (mb+1) + mb->size; 
	Header *h = (Header *) (mb+1); 
	Header *to, *pto=NULL; 

	for (to=h ; (char *) h < end ; h = NEXTH(h)) { 
		if (h->status == 'F') 
			continue; 
		if (to != h) { 
			memcpy(to, h, h->rsize+sizeof(Header)); 
			if (h->next) 
				*((Header **) to->next) = to + 1; 
		} 
		to->size = RND(to->rsize); 
		pto = to; 
		to = NEXTH(to); 
	} 
	if ((char *) to >= end) 
		return NULL; 
	to->status = 'F'; 
	to->size = (end - (char *) to) - sizeof(Header); 
	if (!to->size) { 
		if (pto) 
			pto->size += to->size + sizeof(Header); 
		return NULL; 
	} 
	return to; 
} 
开发者ID:blakemcbride,项目名称:Dynace,代码行数:29,代码来源:memalloc.c


示例11: main

int main(){	
	struct cache_manager *lru_manager;
	int i;

	lru_init(&lru_manager,"LRU", 500, 500, 1, 0);

	for(i =0;i < 1000000;i++){
		struct lru_node *ln = NULL;
		unsigned int blkno = RND(10000);

		ln = CACHE_SEARCH(lru_manager, blkno);
		if(!ln){
			
			ln = CACHE_REPLACE(lru_manager, 0, FCL_REPLACE_ANY);
			ln = CACHE_ALLOC(lru_manager, ln, blkno);
			CACHE_INSERT(lru_manager, ln);
		}else{
			ln = CACHE_REMOVE(lru_manager, ln);
			CACHE_INSERT(lru_manager, ln);
		}
	}	

	CACHE_PRINT(lru_manager, stdout);
	CACHE_CLOSE(lru_manager);

	return 0;
}
开发者ID:lyw965693717,项目名称:flashcachelayer2,代码行数:27,代码来源:lru_test.c


示例12: sha256_compress

/* compress 512-bits */
static int sha256_compress(struct sha256_state *md,
                           unsigned char *buf)
{
  unsigned long S[8], W[64], t0, t1;
  unsigned long t;
  int i;
  /* copy state into S */
  for(i = 0; i < 8; i++) {
    S[i] = md->state[i];
  }
  /* copy the state into 512-bits into W[0..15] */
  for(i = 0; i < 16; i++)
    W[i] = WPA_GET_BE32(buf + (4 * i));
  /* fill W[16..63] */
  for(i = 16; i < 64; i++) {
    W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) +
      W[i - 16];
  }
  /* Compress */
#define RND(a,b,c,d,e,f,g,h,i)                    \
  t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i]; \
  t1 = Sigma0(a) + Maj(a, b, c);                  \
  d += t0;                                        \
  h = t0 + t1;
  for(i = 0; i < 64; ++i) {
    RND(S[0], S[1], S[2], S[3], S[4], S[5], S[6], S[7], i);
    t = S[7]; S[7] = S[6]; S[6] = S[5]; S[5] = S[4];
    S[4] = S[3]; S[3] = S[2]; S[2] = S[1]; S[1] = S[0]; S[0] = t;
  }
  /* feedback */
  for(i = 0; i < 8; i++) {
    md->state[i] = md->state[i] + S[i];
  }
  return 0;
}
开发者ID:ajorians,项目名称:FlowdockAPI,代码行数:36,代码来源:sha256.c


示例13: more_core

static void more_core(unsigned n) 
{ 
	unsigned sz; 
	unsigned as; 
	MemBlk *mb; 
	Header *h; 

	sz = n > DBS ? n : DBS; 
	sz = RND(sz); 
	as = sizeof(MemBlk) + sizeof(Header) + sz; 
	mb = (MemBlk *) malloc(as); 
	if (!mb) { 
#ifndef __COSMIC__ 
		fprintf(stderr, "\nOut of memory.\n"); 
#endif 


#line 235 "memalloc.d"
		exit(1); 
	} 
	mb->next = MMBP; 
	MMBP = mb; 
	mb->size = sz + sizeof(Header); 

	h = (Header *) (mb+1); 
	h->status = 'U'; 
	h->next = NULL; 
	h->size = sz; 
	MA_free(h+1); 
} 
开发者ID:blakemcbride,项目名称:Dynace,代码行数:30,代码来源:memalloc.c


示例14: DormantGhost

static void DormantGhost(GAME_STATE *ptr, G_GHOST *pGhost)
{
	/* Wake him up?? */
	if (RND(30) < 2)
		Pac_ActivateGhost(pGhost, 12,10,eDIR_Left);
	
}
开发者ID:Alexandre251313,项目名称:pacman,代码行数:7,代码来源:ghosts.c


示例15: d

int d(int n, int x)
{
    int tmp = n;

    while (n--)
	tmp += RND(x);
    return tmp;
}
开发者ID:kleopatra999,项目名称:bsd-games-3,代码行数:8,代码来源:rnd.c


示例16: putdata

void putdata(int nini, int nend, double *a)
{
    int j, seed = 0;

    for (j = nini; j <= nend; j++) {
        a[j] = RND(&seed);
    }
}
开发者ID:Kinglions,项目名称:modizer,代码行数:8,代码来源:testxg.c


示例17: animateLMorph

/* neglectible % of execution time */
static void
animateLMorph(struct state *st)
{
    int i;
    if (st->currGamma > st->maxGamma) {
        st->currGamma = 0.0;
        st->nFrom = st->nTo;
        st->nTo = st->nNext;
        st->aFrom = st->a[st->nFrom];
	st->aTo = st->a[st->nTo];
        do {
            st->nNext = RND(st->numFigs);
        } while (st->nNext == st->nTo);
	st->aNext = st->a[st->nNext];

	st->shift = RND(st->numPoints);
        if (RND(2)) {
            /* reverse the array to get more variation. */
            int    i1, i2;
            XPoint p;
            
            for (i1 = 0, i2 = st->numPoints - 1; i1 < st->numPoints / 2; i1++, i2--) {
                p = st->aNext[i1];
                st->aNext[i1] = st->aNext[i2];
                st->aNext[i2] = p;
            }
        }

	/* calculate the slopes */
	for (i = 0; i < st->numPoints ; i++) {
            st->aSlopeFrom[i].x = st->aSlopeTo[i].x;
            st->aSlopeFrom[i].y = st->aSlopeTo[i].y;
            st->aSlopeTo[i].x = st->aNext[i].x - st->aTo[i].x;
            st->aSlopeTo[i].y = (st->aNext[i].y - st->aTo[i].y);
	}
    }

    createPoints(st);
    drawImage(st);
    st->aPrev = st->aCurr;
    st->aCurr = st->aWork[st->nWork ^= 1];

    st->currGamma += st->deltaGamma;
}
开发者ID:davehorner,项目名称:XScreenSaverWin,代码行数:45,代码来源:lmorph.c


示例18: putdata2d

void putdata2d(int n1, int n2, double **a)
{
    int j1, j2, seed = 0;

    for (j1 = 0; j1 <= n1 - 1; j1++) {
        for (j2 = 0; j2 <= n2 - 1; j2++) {
            a[j1][j2] = RND(&seed);
        }
    }
}
开发者ID:ChristianFrisson,项目名称:JamomaCore,代码行数:10,代码来源:shrtdctt.c


示例19: while

void mapCavern::Randomise()
{
	int limit = (m_width * m_height * 2) / 5;
	int count = 0;
	while (count < limit)
	{
		int i, j;

		i = RND(m_width);
		j = RND(m_height);
		if (WallAt(i, j) == WALL_Any)
		{
			WallAt(i, j) = WALL_None;
			count++;
		}
	}

#if 0
	for ( int i = 0; i < m_width * m_height; i++ )
	{
		int random = rand() % 4;
		hnFloor type = WALL_Any;

		switch( random )
		{
			case 0:
			type = WALL_Any;
			break;
			case 1:
			type = WALL_None;
			break;
			case 2:
			type = MATERIAL_Ice;
			break;
			case 3:
			type = MATERIAL_Lava;
			break;
		}

		m_tile[i] = type;
	}
#endif //0
}
开发者ID:dcleyne,项目名称:hacknet,代码行数:43,代码来源:MAP_Cavern.cpp


示例20: errorcheck

double errorcheck(int nini, int nend, double scale, double *a)
{
    int j, seed = 0;
    double err = 0, e;

    for (j = nini; j <= nend; j++) {
        e = RND(&seed) - a[j] * scale;
        err = MAX(err, fabs(e));
    }
    return err;
}
开发者ID:Kinglions,项目名称:modizer,代码行数:11,代码来源:testxg.c



注:本文中的RND函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ RNDUP函数代码示例发布时间:2022-05-30
下一篇:
C++ RNA_struct_property_is_set函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap