BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
BesEvtGen/bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenModels/ranlxd.h File Reference

Go to the source code of this file.

Functions

void ranlxd (double r[], int n)
 
void rlxd_init (int level, int seed)
 
int rlxd_size (void)
 
void rlxd_get (int state[])
 
void rlxd_reset (int state[])
 

Function Documentation

◆ ranlxd()

void ranlxd ( double  r[],
int  n 
)

Definition at line 563 of file BesEvtGen/bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenModels/ranlxd.c.

564{
565 int k;
566
567 if (init==0)
568 rlxd_init(0,1);
569
570 for (k=0;k<n;k++)
571 {
572 is=next[is];
573 if (is==is_old)
574 update();
575 r[k]=one_bit*((double)(x.num[is+4])+one_bit*(double)(x.num[is]));
576 }
577}
const Int_t n

◆ rlxd_get()

void rlxd_get ( int  state[])

Definition at line 586 of file BesEvtGen/bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenModels/ranlxd.c.

587{
588 int k;
589
590 if (init==0)
591 error(3);
592
593 state[0]=rlxd_size();
594
595 for (k=0;k<96;k++)
596 state[k+1]=x.num[k];
597
598 state[97]=carry.c1;
599 state[98]=carry.c2;
600 state[99]=carry.c3;
601 state[100]=carry.c4;
602
603 state[101]=pr;
604 state[102]=ir;
605 state[103]=jr;
606 state[104]=is;
607}
@ error
Definition: Core.h:24

◆ rlxd_init()

void rlxd_init ( int  level,
int  seed 
)

Definition at line 493 of file BesEvtGen/bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenModels/ranlxd.c.

494{
495 int i,k,l;
496 int ibit,jbit,xbit[31];
497 int ix,iy;
498
499 if ((INT_MAX<2147483647)||(FLT_RADIX!=2)||(FLT_MANT_DIG<24)||
500 (DBL_MANT_DIG<48))
501 error(0);
502
503 define_constants();
504
505 if (level==1)
506 pr=202;
507 else if (level==2)
508 pr=397;
509 else
510 error(1);
511
512 i=seed;
513
514 for (k=0;k<31;k++)
515 {
516 xbit[k]=i%2;
517 i/=2;
518 }
519
520 if ((seed<=0)||(i!=0))
521 error(2);
522
523 ibit=0;
524 jbit=18;
525
526 for (i=0;i<4;i++)
527 {
528 for (k=0;k<24;k++)
529 {
530 ix=0;
531
532 for (l=0;l<24;l++)
533 {
534 iy=xbit[ibit];
535 ix=2*ix+iy;
536
537 xbit[ibit]=(xbit[ibit]+xbit[jbit])%2;
538 ibit=(ibit+1)%31;
539 jbit=(jbit+1)%31;
540 }
541
542 if ((k%4)!=i)
543 ix=16777215-ix;
544
545 x.num[4*k+i]=ix;
546 }
547 }
548
549 carry.c1=0;
550 carry.c2=0;
551 carry.c3=0;
552 carry.c4=0;
553
554 ir=0;
555 jr=7;
556 is=91;
557 is_old=0;
558 prm=pr%12;
559 init=1;
560}

◆ rlxd_reset()

void rlxd_reset ( int  state[])

Definition at line 610 of file BesEvtGen/bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenModels/ranlxd.c.

611{
612 int k;
613
614 if ((INT_MAX<2147483647)||(FLT_RADIX!=2)||(FLT_MANT_DIG<24)||
615 (DBL_MANT_DIG<48))
616 error(4);
617
618 define_constants();
619
620 if (state[0]!=rlxd_size())
621 error(5);
622
623 for (k=0;k<96;k++)
624 {
625 if ((state[k+1]<0)||(state[k+1]>=167777216))
626 error(5);
627
628 x.num[k]=state[k+1];
629 }
630
631 if (((state[97]!=0)&&(state[97]!=1))||
632 ((state[98]!=0)&&(state[98]!=1))||
633 ((state[99]!=0)&&(state[99]!=1))||
634 ((state[100]!=0)&&(state[100]!=1)))
635 error(5);
636
637 carry.c1=state[97];
638 carry.c2=state[98];
639 carry.c3=state[99];
640 carry.c4=state[100];
641
642 pr=state[101];
643 ir=state[102];
644 jr=state[103];
645 is=state[104];
646 is_old=8*ir;
647 prm=pr%12;
648 init=1;
649
650 if (((pr!=202)&&(pr!=397))||
651 (ir<0)||(ir>11)||(jr<0)||(jr>11)||(jr!=((ir+7)%12))||
652 (is<0)||(is>91))
653 error(5);
654}

◆ rlxd_size()

int rlxd_size ( void  )

Definition at line 580 of file BesEvtGen/bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenModels/ranlxd.c.

581{
582 return(105);
583}