Knowledge

Subtract with carry

Source 📝

22: 366: 215: 222: 86:
and Arif Zaman in 1991. "Lagged Fibonacci" refers to the fact that each random number is a function of two of the preceding numbers at some specified, fixed offsets, or "lags".
495: 40: 535: 565: 447: 412: 647: 604: 78:: one of many algorithms designed to produce a long series of random-looking numbers based on a small amount of starting data. It is of the 58: 103: 75: 361:{\displaystyle cy(i)={\begin{cases}1,&{\text{if }}x(i-S)-x(i-R)-cy(i-1)<0\\0,&{\text{otherwise}}\end{cases}}} 79: 628: 575: 571: 249: 95: 468: 507: 544: 498: 417: 382: 83: 616: 607:, George Marsaglia and Arif Zaman, The Annals of Applied Probability, Vol. 1, No. 3, 1991 570:
The subtract-with-carry engine is one of the family of generators which includes as well
641: 94:
Sequence generated by the subtract-with-carry engine may be described by the
581:
It is one of three random number generator engines included in the standard
379:
are known as the short and long lags, respectively. Therefore, expressions
582: 15: 195: 354: 210:{\displaystyle x(i)=(x(i-S)-x(i-R)-cy(i-1))\ {\bmod {\ }}M} 36: 547: 541:
is the word size, in bits, of the state sequence and
510: 471: 420: 385: 225: 106: 31:
may be too technical for most readers to understand
559: 529: 489: 441: 406: 360: 209: 8: 600: 598: 546: 521: 509: 470: 419: 384: 346: 260: 244: 224: 198: 194: 105: 59:Learn how and when to remove this message 43:, without removing the technical details. 605:A New Class of Random Number Generators 594: 41:make it understandable to non-experts 7: 457:-th previous terms of the sequence. 14: 617:subtract_with_carry_engine Class 20: 629:std::subtract_with_carry_engine 648:Pseudorandom number generators 619:, Microsoft Visual Studio 2015 436: 424: 401: 389: 325: 313: 301: 289: 280: 268: 238: 232: 188: 185: 173: 161: 149: 140: 128: 122: 116: 110: 1: 76:pseudorandom number generator 490:{\displaystyle 0<S<R} 664: 530:{\displaystyle M=2^{W}} 561: 560:{\displaystyle W>0} 531: 491: 465:satisfy the condition 443: 442:{\displaystyle x(i-R)} 408: 407:{\displaystyle x(i-S)} 362: 211: 562: 532: 492: 444: 409: 363: 212: 576:subtract-with-borrow 545: 508: 469: 418: 383: 223: 104: 96:recurrence relation 82:type introduced by 72:Subtract-with-carry 631:, cppreference.com 557: 527: 487: 449:correspond to the 439: 404: 358: 353: 207: 349: 263: 201: 193: 69: 68: 61: 655: 632: 626: 620: 614: 608: 602: 566: 564: 563: 558: 536: 534: 533: 528: 526: 525: 496: 494: 493: 488: 448: 446: 445: 440: 413: 411: 410: 405: 367: 365: 364: 359: 357: 356: 350: 347: 264: 261: 216: 214: 213: 208: 203: 202: 199: 191: 84:George Marsaglia 80:lagged Fibonacci 64: 57: 53: 50: 44: 24: 23: 16: 663: 662: 658: 657: 656: 654: 653: 652: 638: 637: 636: 635: 627: 623: 615: 611: 603: 596: 591: 543: 542: 517: 506: 505: 467: 466: 416: 415: 381: 380: 352: 351: 344: 335: 334: 258: 245: 221: 220: 102: 101: 92: 65: 54: 48: 45: 37:help improve it 34: 25: 21: 12: 11: 5: 661: 659: 651: 650: 640: 639: 634: 633: 621: 609: 593: 592: 590: 587: 572:add-with-carry 556: 553: 550: 524: 520: 516: 513: 504:has the value 486: 483: 480: 477: 474: 438: 435: 432: 429: 426: 423: 403: 400: 397: 394: 391: 388: 355: 345: 343: 340: 337: 336: 333: 330: 327: 324: 321: 318: 315: 312: 309: 306: 303: 300: 297: 294: 291: 288: 285: 282: 279: 276: 273: 270: 267: 259: 257: 254: 251: 250: 248: 243: 240: 237: 234: 231: 228: 206: 197: 190: 187: 184: 181: 178: 175: 172: 169: 166: 163: 160: 157: 154: 151: 148: 145: 142: 139: 136: 133: 130: 127: 124: 121: 118: 115: 112: 109: 91: 88: 67: 66: 28: 26: 19: 13: 10: 9: 6: 4: 3: 2: 660: 649: 646: 645: 643: 630: 625: 622: 618: 613: 610: 606: 601: 599: 595: 588: 586: 584: 579: 577: 573: 568: 554: 551: 548: 540: 522: 518: 514: 511: 503: 500: 484: 481: 478: 475: 472: 464: 460: 456: 452: 433: 430: 427: 421: 398: 395: 392: 386: 378: 374: 369: 341: 338: 331: 328: 322: 319: 316: 310: 307: 304: 298: 295: 292: 286: 283: 277: 274: 271: 265: 255: 252: 246: 241: 235: 229: 226: 217: 204: 182: 179: 176: 170: 167: 164: 158: 155: 152: 146: 143: 137: 134: 131: 125: 119: 113: 107: 99: 97: 89: 87: 85: 81: 77: 73: 63: 60: 52: 42: 38: 32: 29:This article 27: 18: 17: 624: 612: 580: 569: 538: 501: 462: 458: 454: 450: 376: 372: 370: 218: 100: 93: 71: 70: 55: 46: 30: 589:References 371:Constants 585:library. 578:engines. 431:− 396:− 348:otherwise 320:− 305:− 296:− 284:− 275:− 180:− 165:− 156:− 144:− 135:− 90:Algorithm 49:July 2013 642:Category 537:, where 453:-th and 262:if  499:Modulus 35:Please 219:where 200:  192:  583:C++11 74:is a 574:and 552:> 482:< 476:< 461:and 414:and 375:and 329:< 196:mod 39:to 644:: 597:^ 567:. 497:. 368:. 98:: 555:0 549:W 539:W 523:W 519:2 515:= 512:M 502:M 485:R 479:S 473:0 463:R 459:S 455:R 451:S 437:) 434:R 428:i 425:( 422:x 402:) 399:S 393:i 390:( 387:x 377:R 373:S 342:, 339:0 332:0 326:) 323:1 317:i 314:( 311:y 308:c 302:) 299:R 293:i 290:( 287:x 281:) 278:S 272:i 269:( 266:x 256:, 253:1 247:{ 242:= 239:) 236:i 233:( 230:y 227:c 205:M 189:) 186:) 183:1 177:i 174:( 171:y 168:c 162:) 159:R 153:i 150:( 147:x 141:) 138:S 132:i 129:( 126:x 123:( 120:= 117:) 114:i 111:( 108:x 62:) 56:( 51:) 47:( 33:.

Index

help improve it
make it understandable to non-experts
Learn how and when to remove this message
pseudorandom number generator
lagged Fibonacci
George Marsaglia
recurrence relation
Modulus
add-with-carry
subtract-with-borrow
C++11


A New Class of Random Number Generators
subtract_with_carry_engine Class
std::subtract_with_carry_engine
Category
Pseudorandom number generators

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.