Go to the source code of this file.
◆ ranlxd()
void ranlxd |
( |
double |
r[], |
|
|
int |
n |
|
) |
| |
Definition at line 563 of file ranlxd.c.
564{
565 int k;
566
567 if (init==0)
569
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}
void rlxd_init(int level, int seed)
Referenced by ranlxdf_().
◆ rlxd_get()
void rlxd_get |
( |
int |
state[] | ) |
|
Definition at line 586 of file ranlxd.c.
587{
588 int k;
589
590 if (init==0)
592
594
595 for (k=0;k<96;k++)
596 state[k+1]=x.num[k];
597
602
603 state[101]=pr;
604 state[102]=ir;
605 state[103]=jr;
606 state[104]=is;
607}
Referenced by rlxdgetf_().
◆ rlxd_init()
void rlxd_init |
( |
int |
level, |
|
|
int |
seed |
|
) |
| |
Definition at line 493 of file 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))
502
503 define_constants();
504
505 if (level==1)
506 pr=202;
507 else if (level==2)
508 pr=397;
509 else
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))
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
553
554 ir=0;
555 jr=7;
556 is=91;
557 is_old=0;
558 prm=pr%12;
559 init=1;
560}
Referenced by ranlxd(), and rlxdinit_().
◆ rlxd_reset()
void rlxd_reset |
( |
int |
state[] | ) |
|
Definition at line 610 of file ranlxd.c.
611{
612 int k;
613
614 if ((INT_MAX<2147483647)||(FLT_RADIX!=2)||(FLT_MANT_DIG<24)||
615 (DBL_MANT_DIG<48))
617
618 define_constants();
619
622
623 for (k=0;k<96;k++)
624 {
625 if ((state[k+1]<0)||(state[k+1]>=167777216))
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)))
636
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))
654}
Referenced by rlxdresetf_().
◆ rlxd_size()