[
  {
    "path": ".gitignore",
    "content": "target\n"
  },
  {
    "path": "Cargo.toml",
    "content": "[package]\nname = \"opensimplex2\"\nversion = \"1.1.0\"\nedition = \"2021\"\n\ndescription = \"Port of OpenSimplex2\"\nauthors = [\"KdotJPG\"]\nlicense = \"CC0-1.0\"\nrepository = \"https://github.com/KdotJPG/OpenSimplex2\"\ncategories = [\"algorithms\", \"graphics\", \"game-development\"]\nkeywords = [\"OpenSimplex\", \"Simplex\", \"noise\", \"random\", \"Perlin\"]\n\n# omit java, etc. from .crate file\ninclude = [\n\t\"Cargo.toml\",\n\t\"rust/*.rs\",\n]\n\n[lib]\npath = \"rust/lib.rs\"\ncrate-type = [\"rlib\", \"staticlib\", \"cdylib\"]\n"
  },
  {
    "path": "LICENSE",
    "content": "Creative Commons Legal Code\n\nCC0 1.0 Universal\n\n    CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE\n    LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN\n    ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS\n    INFORMATION ON AN \"AS-IS\" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES\n    REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS\n    PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM\n    THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED\n    HEREUNDER.\n\nStatement of Purpose\n\nThe laws of most jurisdictions throughout the world automatically confer\nexclusive Copyright and Related Rights (defined below) upon the creator\nand subsequent owner(s) (each and all, an \"owner\") of an original work of\nauthorship and/or a database (each, a \"Work\").\n\nCertain owners wish to permanently relinquish those rights to a Work for\nthe purpose of contributing to a commons of creative, cultural and\nscientific works (\"Commons\") that the public can reliably and without fear\nof later claims of infringement build upon, modify, incorporate in other\nworks, reuse and redistribute as freely as possible in any form whatsoever\nand for any purposes, including without limitation commercial purposes.\nThese owners may contribute to the Commons to promote the ideal of a free\nculture and the further production of creative, cultural and scientific\nworks, or to gain reputation or greater distribution for their Work in\npart through the use and efforts of others.\n\nFor these and/or other purposes and motivations, and without any\nexpectation of additional consideration or compensation, the person\nassociating CC0 with a Work (the \"Affirmer\"), to the extent that he or she\nis an owner of Copyright and Related Rights in the Work, voluntarily\nelects to apply CC0 to the Work and publicly distribute the Work under its\nterms, with knowledge of his or her Copyright and Related Rights in the\nWork and the meaning and intended legal effect of CC0 on those rights.\n\n1. Copyright and Related Rights. A Work made available under CC0 may be\nprotected by copyright and related or neighboring rights (\"Copyright and\nRelated Rights\"). Copyright and Related Rights include, but are not\nlimited to, the following:\n\n  i. the right to reproduce, adapt, distribute, perform, display,\n     communicate, and translate a Work;\n ii. moral rights retained by the original author(s) and/or performer(s);\niii. publicity and privacy rights pertaining to a person's image or\n     likeness depicted in a Work;\n iv. rights protecting against unfair competition in regards to a Work,\n     subject to the limitations in paragraph 4(a), below;\n  v. rights protecting the extraction, dissemination, use and reuse of data\n     in a Work;\n vi. database rights (such as those arising under Directive 96/9/EC of the\n     European Parliament and of the Council of 11 March 1996 on the legal\n     protection of databases, and under any national implementation\n     thereof, including any amended or successor version of such\n     directive); and\nvii. other similar, equivalent or corresponding rights throughout the\n     world based on applicable law or treaty, and any national\n     implementations thereof.\n\n2. Waiver. To the greatest extent permitted by, but not in contravention\nof, applicable law, Affirmer hereby overtly, fully, permanently,\nirrevocably and unconditionally waives, abandons, and surrenders all of\nAffirmer's Copyright and Related Rights and associated claims and causes\nof action, whether now known or unknown (including existing as well as\nfuture claims and causes of action), in the Work (i) in all territories\nworldwide, (ii) for the maximum duration provided by applicable law or\ntreaty (including future time extensions), (iii) in any current or future\nmedium and for any number of copies, and (iv) for any purpose whatsoever,\nincluding without limitation commercial, advertising or promotional\npurposes (the \"Waiver\"). Affirmer makes the Waiver for the benefit of each\nmember of the public at large and to the detriment of Affirmer's heirs and\nsuccessors, fully intending that such Waiver shall not be subject to\nrevocation, rescission, cancellation, termination, or any other legal or\nequitable action to disrupt the quiet enjoyment of the Work by the public\nas contemplated by Affirmer's express Statement of Purpose.\n\n3. Public License Fallback. Should any part of the Waiver for any reason\nbe judged legally invalid or ineffective under applicable law, then the\nWaiver shall be preserved to the maximum extent permitted taking into\naccount Affirmer's express Statement of Purpose. In addition, to the\nextent the Waiver is so judged Affirmer hereby grants to each affected\nperson a royalty-free, non transferable, non sublicensable, non exclusive,\nirrevocable and unconditional license to exercise Affirmer's Copyright and\nRelated Rights in the Work (i) in all territories worldwide, (ii) for the\nmaximum duration provided by applicable law or treaty (including future\ntime extensions), (iii) in any current or future medium and for any number\nof copies, and (iv) for any purpose whatsoever, including without\nlimitation commercial, advertising or promotional purposes (the\n\"License\"). The License shall be deemed effective as of the date CC0 was\napplied by Affirmer to the Work. Should any part of the License for any\nreason be judged legally invalid or ineffective under applicable law, such\npartial invalidity or ineffectiveness shall not invalidate the remainder\nof the License, and in such case Affirmer hereby affirms that he or she\nwill not (i) exercise any of his or her remaining Copyright and Related\nRights in the Work or (ii) assert any associated claims and causes of\naction with respect to the Work, in either case contrary to Affirmer's\nexpress Statement of Purpose.\n\n4. Limitations and Disclaimers.\n\n a. No trademark or patent rights held by Affirmer are waived, abandoned,\n    surrendered, licensed or otherwise affected by this document.\n b. Affirmer offers the Work as-is and makes no representations or\n    warranties of any kind concerning the Work, express, implied,\n    statutory or otherwise, including without limitation warranties of\n    title, merchantability, fitness for a particular purpose, non\n    infringement, or the absence of latent or other defects, accuracy, or\n    the present or absence of errors, whether or not discoverable, all to\n    the greatest extent permissible under applicable law.\n c. Affirmer disclaims responsibility for clearing rights of other persons\n    that may apply to the Work or any use thereof, including without\n    limitation any person's Copyright and Related Rights in the Work.\n    Further, Affirmer disclaims responsibility for obtaining any necessary\n    consents, permissions or other rights required for any use of the\n    Work.\n d. Affirmer understands and acknowledges that Creative Commons is not a\n    party to this document and has no duty or obligation with respect to\n    this CC0 or use of the Work.\n"
  },
  {
    "path": "README.md",
    "content": "# OpenSimplex 2\n\nSuccessors to OpenSimplex Noise, plus updated OpenSimplex. Includes 2D, 3D, and 4D noise.\n\n## Motivation\n\nLegacy OpenSimplex used a different grid layout scheme to Simplex. It worked fine for common applications, but didn't produce as consistent contrast as the original Simplex point layout in 3D/4D. It also broke down completely when extended to 5D+, producing diagonal bands of visibly-varying value ranges.\n\nInstead of vertex rearrangement, OpenSimplex2 focuses on congruent layouts constructed and traversed using disparate methods where need was concluded.\n\nGradient vector tables were also revisited to improve probability symmetry in both the old and new noise.\n\n## Included\n\n### OpenSimplex2(F)\n * Looks the most like Simplex.\n * Is about as fast as common Simplex implementations.\n * 3D is implemented by constructing a rotated body-centered-cubic grid as the offset union of two rotated cubic grids, and finding the closest two points on each.\n * 4D is implemented using 5 offset copies of the dual (reverse-skewed) grid to produce the target grid. This technique generalizes to any number of dimensions.\n * Bundled 2D function is just 2D Simplex with a nice gradient table. The 4D technique does extend to 2D, but this was found to be faster and I couldn't find evidence of limitations on its use. 3D and 4D are novel contributions to the field.\n\n### OpenSimplex2S\n * Looks the most like 2014 OpenSimplex.\n * Uses large vertex contribution ranges like 2014 OpenSimplex, but has better uniformity in 3D and 4D.\n * 3D is implemented analogously to OpenSimplex2(F), but finds the closest four points on each to match the larger radius.\n * 4D is implemented using the ordinary skew and a pre-generated 4x4x4x4 lookup table. I have a work-in-progress more-procedural implementation in my project backlog, which I will swap in if I find it to be competitive in performance.\n * 2D is based on Simplex, but uses a different process to find which points are in range.\n * Recommended choice for ridged noise (if passing individual layers into `abs(x)`).\n\n### Legacy OpenSimplex with updated gradients\n * In some code bases using original OpenSimplex, it may take fewer dev cycles to swap in the same noise that just has the new gradient tables. This brings moderate improvements without changing consistency characteristics or internal frequency.\n * Included in `_old/{language}/legacy`.\n\n### Older OpenSimplex2 implementations\n * OpenSimplex2 noise implementations from before performance and portability re-engineering.\n * Can also be found in the `_old` directory.\n\nNote: area-generators have been moved to [their original repository](https://github.com/KdotJPG/Noise-VertexQueue-AreaGen).\n\n## C FFI usage\nInstall a [Rust toolchain](https://www.rust-lang.org/tools/install) if needed.\n\nBuild debug or release artifacts with:\n```\ncargo build\n# or\ncargo build --release\n```\nLibrary files will be in `./target/{debug,release}/`. Copy header from [`./rust/OpenSimplex2.h`](./rust/OpenSimplex2.h).\n\n## Changelog\n\n* Tuned up this `README.md`. (Mar 26, 2022)\n* Re-wrote functions to be instancelessly seedable and less dependent on lookup tables. Re-organized repository. Renamed `OpenSimplex2F` to just `OpenSimplex2` in file/class names. (Jan 16, 2022)\n* Shortened lookup table for Simplex/OpenSimplex2(F) 4D (July 5, 2020)\n* Added 4D to OpenSimplex2(F) Java/C#, port OpenSimplex2S 4D to C#. (July 5, 2020)\n* Added 4D to OpenSimplex2S Java. (Apr 30, 2020)\n* Replaced individual renders in `README.md` with consolidated renders. (Feb 10, 2020)\n* Replaced 12-direction 2D gradient set with a 24-direction set, to reduce visible feature repetition in thresholded single-octave 2D noise. (Feb 10, 2020)\n* Renamed filenames FastSimplexStyleNoise to OpenSimplex2F, and SuperSimplexNoise to OpenSimplex2S. (Feb 10, 2020)\n* Moved legacy OpenSimplex into legacy directories. (Feb 10, 2020)\n* Slightly reorganized description above, and added TODO/changelog. (Jan 23, 2020)\n* Renamed / additionally named the noise \"OpenSimplex (2.0)\", separated into two versions/variants. (Jan 23, 2020)\n  * SuperSimplex and FastSimplexStyleNoise are very similar to each other algorithmically, and are in the same spirit as the original OpenSimplex.\n  * OpenSimplex is used in a lot of projects, and the naming might help facilitate adoption of the new noise in its place.\n* Add C# ports of evaluators. (Jan 13, 2020)\n* Create separate files which include area generators. (Jan 13, 2020)\n* Renamed PlaneFirst evaluators to XYBeforeZ, and added XZBeforeY. (Jan 13, 2020)\n* Fixed equals() method in AreaGenLatticePoint3D for area generators. (Dec 24, 2019)\n\n## Renders\n\n### 2D Noise\n\n![Renders 2D](https://user-images.githubusercontent.com/8829856/149676975-ba7cfc82-3bb5-4e0c-b6cb-8315eca51193.png)\n\n* OpenSimplex2S is a smoother copy of OpenSimplex2(F).\n* OpenSimplex2S and Updated OpenSimplex are effectively identical.\n* Original OpenSimplex produced more straight parts and was not as probabilistically symmetric.\n\n### 3D Noise (ImproveXY Orientation)\n\n![Renders 3D ImproveXY](https://user-images.githubusercontent.com/8829856/149676980-768775b4-f0ca-417b-aa0a-2379b61fb69d.png)\n\n* OpenSimplex2(F) and OpenSimplex2S, 2D slices of 3D ImproveXY, keep mostly the same properties as you move along the third axis.\n* Updated OpenSimplex looks good in both slices, but the slices look different from each other. In an animation, this is particularly noticeable.\n* Original OpenSimplex was less uniform and not as probabilistically symmetric.\n\n### 3D Noise (Fallback Orientation)\n\n![Renders 3D Fallback](https://user-images.githubusercontent.com/8829856/149676981-2d40fff9-b585-4fca-9a09-eb51d5927fec.png)\n\n* OpenSimplex2(F) and OpenSimplex2S, 2D slices of 3D in the classic lattice orientation, look decent but are less ideal for X/Y planes being the primary focus.\n* This Updated OpenSimplex render appears to show less directional bias than original OpenSimplex.\n\n### 4D Noise (ImproveXY_ImproveZW Orientation)\n\n![Renders 4D ImproveXY_ImproveZW](https://user-images.githubusercontent.com/8829856/149676999-14dc7dfc-a94c-4a8a-b654-00e25f33eb68.png)\n\n* OpenSimplex2S 4D has higher apparent contrast than original OpenSimplex.\n* OpenSimplex2(F) 4D has a very dotty appearance. Fine for fBm, but may pair best with extra steps if used for ridged noise.\n\n### 4D Noise (ImproveXYZ Orientation)\n\n![Renders 4D ImproveXYZ](https://user-images.githubusercontent.com/8829856/149677002-542aefc5-3e60-46d2-ac4a-6d947c0b94a7.png)\n\n* 2D slices look fine, but this rotation is most intended for texturing 3D objects with an additional time variable.\n\n### 4D Noise (Fallback Orientation)\n\n![Renders 4D Fallback](https://user-images.githubusercontent.com/8829856/149677011-267ab94c-3f3b-47bf-85a2-7b00befa95d6.png)\n\n* OpenSimplex2(F) has the most noticeable diagonal artifacts, followed by Old OpenSimplex.\n\n### 4D Noise (Torus Mapping)\n\n![Renders 4D Torus](https://user-images.githubusercontent.com/8829856/149677013-c0593b51-b757-41ed-9ece-1bf2f88feee7.png)\n\n* Seamless tileable 2D noise from 4D, mapped using noise4(r sin x, r cos x, r sin y, r cos y)\n\n## Public Domain Dedication\n\nThis is free and unencumbered software. The majority of files are released under CC0. Where marked, files in certain directories fall under UNLICENSE instead, as they were based off of UNLICENSE code other than mine (e.g. Pull Requests, legacy OpenSimplex with DigitalShadow's lookup tables). To the best of my non-lawyer knowledge, no patent claims cover anything implemented here (though also nothing here is legal advice). Please use this software to make cool things, rather than to make patents! Enjoy.\n"
  },
  {
    "path": "_old/c/Makefile",
    "content": "\nCFLAGS=-Wall -Wextra --pedantic -O3\n# CFLAGS=-Wall -Wextra --pedantic -g -fsanitize=undefined\n# CFLAGS=-Wall -Wextra --pedantic -g -fsanitize=address\n\nall:\tOpenSimplex2F.o test_OpenSimplex2F\n\nOpenSimplex2F.o:\tOpenSimplex2F.c OpenSimplex2F.h Makefile\n\t$(CC) ${CFLAGS} -c OpenSimplex2F.c -lm\n\ntest_OpenSimplex2F:\ttest_OpenSimplex2F.c OpenSimplex2F.o Makefile\n\t$(CC) ${CFLAGS} -o test_OpenSimplex2F test_OpenSimplex2F.c OpenSimplex2F.o -lm -lpng\n\nclean:\n\trm -f *.o test_OpenSimplex2F test2d.png test3d.png test4d.png\n\n\n"
  },
  {
    "path": "_old/c/OpenSimplex2F.c",
    "content": "/**\n * K.jpg's OpenSimplex 2, faster variant\n *\n * - 2D is standard simplex implemented using a lookup table.\n * - 3D is \"Re-oriented 4-point BCC noise\" which constructs a\n *   congruent BCC lattice in a much different way than usual.\n * - 4D constructs the lattice as a union of five copies of its\n *   reciprocal. It successively finds the closest point on each.\n *\n * Multiple versions of each function are provided. See the\n * documentation above each, for more info.\n */\n#include <stdlib.h>\n#include <math.h>\n#include <stdbool.h>\n#include <string.h>\n\n#include \"OpenSimplex2F.h\"\n\n#define PSIZE (2048)\n#define PMASK (2047)\nstatic const double N2 = 0.01001634121365712;\nstatic const double N3 = 0.030485933181293584;\nstatic const double N4 = 0.009202377986303158;\n\n#define B0000 0x00\n#define B0001 0x01\n#define B0010 0x02\n#define B0011 0x03\n#define B0100 0x04\n#define B0101 0x05\n#define B0110 0x06\n#define B0111 0x07\n#define B1000 0x08\n#define B1001 0x09\n#define B1010 0x0a\n#define B1011 0x0b\n#define B1100 0x0c\n#define B1101 0x0d\n#define B1110 0x0e\n#define B1111 0x0f\n\nstruct Grad2 {\n\tdouble dx, dy;\n};\n\nstruct Grad3 {\n\tdouble dx, dy, dz;\n};\n\nstruct Grad4 {\n\tdouble dx, dy, dz, dw;\n};\n\nstruct LatticePoint2D {\n\tint xsv, ysv;\n\tdouble dx, dy;\n};\n\nstatic struct LatticePoint2D *new_LatticePoint2D(int xsv, int ysv)\n{\n\tstruct LatticePoint2D *this = calloc(1, sizeof(*this));\n\n\tthis->xsv = xsv; this->ysv = ysv;\n\tdouble ssv = (xsv + ysv) * -0.211324865405187;\n\tthis->dx = -xsv - ssv;\n\tthis->dy = -ysv - ssv;\n\treturn this;\n}\n\nstruct LatticePoint3D {\n\tdouble dxr, dyr, dzr;\n\tint xrv, yrv, zrv;\n\tstruct LatticePoint3D *nextOnFailure, *nextOnSuccess;\n};\n\nstatic struct LatticePoint3D *new_LatticePoint3D(int xrv, int yrv, int zrv, int lattice)\n{\n\tstruct LatticePoint3D *this = calloc(1, sizeof(*this));\n\n\tthis->dxr = -xrv + lattice * 0.5; this->dyr = -yrv + lattice * 0.5; this->dzr = -zrv + lattice * 0.5;\n\tthis->xrv = xrv + lattice * 1024; this->yrv = yrv + lattice * 1024; this->zrv = zrv + lattice * 1024;\n\treturn this;\n}\n\nstatic void find_unique_pointers(struct LatticePoint3D *tree, struct LatticePoint3D *list[], int *n)\n{\n\tif (!tree)\n\t\treturn;\n\tint i, found;\n\n\tfound = 0;\n\tfor (i = 0; i < *n; i++) {\n\t\tif (list[i] == tree) {\n\t\t\tfound = 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (!found) {\n\t\tlist[*n] = tree;\n\t\t(*n)++;\n\t}\n\tfind_unique_pointers(tree->nextOnFailure, list, n);\n\tfind_unique_pointers(tree->nextOnSuccess, list, n);\n}\n\nstatic void free_LatticePoint3D(struct LatticePoint3D *list[], int n)\n{\n\tint i;\n\n\tfor (i = 0; i < n; i++)\n\t\tfree(list[i]);\n}\n\nstruct LatticePoint4D {\n\tint xsv, ysv, zsv, wsv;\n\tdouble dx, dy, dz, dw;\n\tdouble xsi, ysi, zsi, wsi;\n\tdouble ssiDelta;\n};\n\nstatic struct LatticePoint4D *new_LatticePoint4D(int xsv, int ysv, int zsv, int wsv)\n{\n\tstruct LatticePoint4D *this = calloc(1, sizeof(*this));\n\n\tthis->xsv = xsv + 409; this->ysv = ysv + 409; this->zsv = zsv + 409; this->wsv = wsv + 409;\n\tdouble ssv = (xsv + ysv + zsv + wsv) * 0.309016994374947;\n\tthis->dx = -xsv - ssv;\n\tthis->dy = -ysv - ssv;\n\tthis->dz = -zsv - ssv;\n\tthis->dw = -wsv - ssv;\n\tthis->xsi = 0.2 - xsv;\n\tthis->ysi = 0.2 - ysv;\n\tthis->zsi = 0.2 - zsv;\n\tthis->wsi = 0.2 - wsv;\n\tthis->ssiDelta = (0.8 - xsv - ysv - zsv - wsv) * 0.309016994374947;\n\treturn this;\n}\n\nstruct OpenSimplex2F_context {\n\tint16_t *perm;\n\tstruct Grad2 *permGrad2;\n\tstruct Grad3 *permGrad3;\n\tstruct Grad4 *permGrad4;\n};\n\n#define ARRAYSIZE(x) (sizeof(x) / sizeof((x)[0]))\n\nstatic struct Grad2 GRADIENTS_2D[PSIZE];\nstatic struct Grad3 GRADIENTS_3D[PSIZE];\nstatic struct Grad4 GRADIENTS_4D[PSIZE];\nstatic struct LatticePoint2D *LOOKUP_2D[4];\nstatic struct LatticePoint3D *LOOKUP_3D[8];\nstatic struct LatticePoint4D *VERTICES_4D[16];\n\nstatic struct Grad2 grad2[] = {\n\t{ 0.130526192220052,  0.99144486137381},\n\t{ 0.38268343236509,   0.923879532511287},\n\t{ 0.608761429008721,  0.793353340291235},\n\t{ 0.793353340291235,  0.608761429008721},\n\t{ 0.923879532511287,  0.38268343236509},\n\t{ 0.99144486137381,   0.130526192220051},\n\t{ 0.99144486137381,  -0.130526192220051},\n\t{ 0.923879532511287, -0.38268343236509},\n\t{ 0.793353340291235, -0.60876142900872},\n\t{ 0.608761429008721, -0.793353340291235},\n\t{ 0.38268343236509,  -0.923879532511287},\n\t{ 0.130526192220052, -0.99144486137381},\n\t{-0.130526192220052, -0.99144486137381},\n\t{-0.38268343236509,  -0.923879532511287},\n\t{-0.608761429008721, -0.793353340291235},\n\t{-0.793353340291235, -0.608761429008721},\n\t{-0.923879532511287, -0.38268343236509},\n\t{-0.99144486137381,  -0.130526192220052},\n\t{-0.99144486137381,   0.130526192220051},\n\t{-0.923879532511287,  0.38268343236509},\n\t{-0.793353340291235,  0.608761429008721},\n\t{-0.608761429008721,  0.793353340291235},\n\t{-0.38268343236509,   0.923879532511287},\n\t{-0.130526192220052,  0.99144486137381}\n};\n\nstatic struct Grad3 grad3[] = {\n\t{-2.22474487139,      -2.22474487139,      -1.0},\n\t{-2.22474487139,      -2.22474487139,       1.0},\n\t{-3.0862664687972017, -1.1721513422464978,  0.0},\n\t{-1.1721513422464978, -3.0862664687972017,  0.0},\n\t{-2.22474487139,      -1.0,                -2.22474487139},\n\t{-2.22474487139,       1.0,                -2.22474487139},\n\t{-1.1721513422464978,  0.0,                -3.0862664687972017},\n\t{-3.0862664687972017,  0.0,                -1.1721513422464978},\n\t{-2.22474487139,      -1.0,                 2.22474487139},\n\t{-2.22474487139,       1.0,                 2.22474487139},\n\t{-3.0862664687972017,  0.0,                 1.1721513422464978},\n\t{-1.1721513422464978,  0.0,                 3.0862664687972017},\n\t{-2.22474487139,       2.22474487139,      -1.0},\n\t{-2.22474487139,       2.22474487139,       1.0},\n\t{-1.1721513422464978,  3.0862664687972017,  0.0},\n\t{-3.0862664687972017,  1.1721513422464978,  0.0},\n\t{-1.0,                -2.22474487139,      -2.22474487139},\n\t{ 1.0,                -2.22474487139,      -2.22474487139},\n\t{ 0.0,                -3.0862664687972017, -1.1721513422464978},\n\t{ 0.0,                -1.1721513422464978, -3.0862664687972017},\n\t{-1.0,                -2.22474487139,       2.22474487139},\n\t{ 1.0,                -2.22474487139,       2.22474487139},\n\t{ 0.0,                -1.1721513422464978,  3.0862664687972017},\n\t{ 0.0,                -3.0862664687972017,  1.1721513422464978},\n\t{-1.0,                 2.22474487139,      -2.22474487139},\n\t{ 1.0,                 2.22474487139,      -2.22474487139},\n\t{ 0.0,                 1.1721513422464978, -3.0862664687972017},\n\t{ 0.0,                 3.0862664687972017, -1.1721513422464978},\n\t{-1.0,                 2.22474487139,       2.22474487139},\n\t{ 1.0,                 2.22474487139,       2.22474487139},\n\t{ 0.0,                 3.0862664687972017,  1.1721513422464978},\n\t{ 0.0,                 1.1721513422464978,  3.0862664687972017},\n\t{ 2.22474487139,      -2.22474487139,      -1.0},\n\t{ 2.22474487139,      -2.22474487139,       1.0},\n\t{ 1.1721513422464978, -3.0862664687972017,  0.0},\n\t{ 3.0862664687972017, -1.1721513422464978,  0.0},\n\t{ 2.22474487139,      -1.0,                -2.22474487139},\n\t{ 2.22474487139,       1.0,                -2.22474487139},\n\t{ 3.0862664687972017,  0.0,                -1.1721513422464978},\n\t{ 1.1721513422464978,  0.0,                -3.0862664687972017},\n\t{ 2.22474487139,      -1.0,                 2.22474487139},\n\t{ 2.22474487139,       1.0,                 2.22474487139},\n\t{ 1.1721513422464978,  0.0,                 3.0862664687972017},\n\t{ 3.0862664687972017,  0.0,                 1.1721513422464978},\n\t{ 2.22474487139,       2.22474487139,      -1.0},\n\t{ 2.22474487139,       2.22474487139,       1.0},\n\t{ 3.0862664687972017,  1.1721513422464978,  0.0},\n\t{ 1.1721513422464978,  3.0862664687972017,  0.0}\n};\n\nstatic struct Grad4 grad4[] = {\n\t{-0.753341017856078,    -0.37968289875261624,  -0.37968289875261624,  -0.37968289875261624},\n\t{-0.7821684431180708,   -0.4321472685365301,   -0.4321472685365301,    0.12128480194602098},\n\t{-0.7821684431180708,   -0.4321472685365301,    0.12128480194602098,  -0.4321472685365301},\n\t{-0.7821684431180708,    0.12128480194602098,  -0.4321472685365301,   -0.4321472685365301},\n\t{-0.8586508742123365,   -0.508629699630796,     0.044802370851755174,  0.044802370851755174},\n\t{-0.8586508742123365,    0.044802370851755174, -0.508629699630796,     0.044802370851755174},\n\t{-0.8586508742123365,    0.044802370851755174,  0.044802370851755174, -0.508629699630796},\n\t{-0.9982828964265062,   -0.03381941603233842,  -0.03381941603233842,  -0.03381941603233842},\n\t{-0.37968289875261624,  -0.753341017856078,    -0.37968289875261624,  -0.37968289875261624},\n\t{-0.4321472685365301,   -0.7821684431180708,   -0.4321472685365301,    0.12128480194602098},\n\t{-0.4321472685365301,   -0.7821684431180708,    0.12128480194602098,  -0.4321472685365301},\n\t{ 0.12128480194602098,  -0.7821684431180708,   -0.4321472685365301,   -0.4321472685365301},\n\t{-0.508629699630796,    -0.8586508742123365,    0.044802370851755174,  0.044802370851755174},\n\t{ 0.044802370851755174, -0.8586508742123365,   -0.508629699630796,     0.044802370851755174},\n\t{ 0.044802370851755174, -0.8586508742123365,    0.044802370851755174, -0.508629699630796},\n\t{-0.03381941603233842,  -0.9982828964265062,   -0.03381941603233842,  -0.03381941603233842},\n\t{-0.37968289875261624,  -0.37968289875261624,  -0.753341017856078,    -0.37968289875261624},\n\t{-0.4321472685365301,   -0.4321472685365301,   -0.7821684431180708,    0.12128480194602098},\n\t{-0.4321472685365301,    0.12128480194602098,  -0.7821684431180708,   -0.4321472685365301},\n\t{ 0.12128480194602098,  -0.4321472685365301,   -0.7821684431180708,   -0.4321472685365301},\n\t{-0.508629699630796,     0.044802370851755174, -0.8586508742123365,    0.044802370851755174},\n\t{ 0.044802370851755174, -0.508629699630796,    -0.8586508742123365,    0.044802370851755174},\n\t{ 0.044802370851755174,  0.044802370851755174, -0.8586508742123365,   -0.508629699630796},\n\t{-0.03381941603233842,  -0.03381941603233842,  -0.9982828964265062,   -0.03381941603233842},\n\t{-0.37968289875261624,  -0.37968289875261624,  -0.37968289875261624,  -0.753341017856078},\n\t{-0.4321472685365301,   -0.4321472685365301,    0.12128480194602098,  -0.7821684431180708},\n\t{-0.4321472685365301,    0.12128480194602098,  -0.4321472685365301,   -0.7821684431180708},\n\t{ 0.12128480194602098,  -0.4321472685365301,   -0.4321472685365301,   -0.7821684431180708},\n\t{-0.508629699630796,     0.044802370851755174,  0.044802370851755174, -0.8586508742123365},\n\t{ 0.044802370851755174, -0.508629699630796,     0.044802370851755174, -0.8586508742123365},\n\t{ 0.044802370851755174,  0.044802370851755174, -0.508629699630796,    -0.8586508742123365},\n\t{-0.03381941603233842,  -0.03381941603233842,  -0.03381941603233842,  -0.9982828964265062},\n\t{-0.6740059517812944,   -0.3239847771997537,   -0.3239847771997537,    0.5794684678643381},\n\t{-0.7504883828755602,   -0.4004672082940195,    0.15296486218853164,   0.5029860367700724},\n\t{-0.7504883828755602,    0.15296486218853164,  -0.4004672082940195,    0.5029860367700724},\n\t{-0.8828161875373585,    0.08164729285680945,   0.08164729285680945,   0.4553054119602712},\n\t{-0.4553054119602712,   -0.08164729285680945,  -0.08164729285680945,   0.8828161875373585},\n\t{-0.5029860367700724,   -0.15296486218853164,   0.4004672082940195,    0.7504883828755602},\n\t{-0.5029860367700724,    0.4004672082940195,   -0.15296486218853164,   0.7504883828755602},\n\t{-0.5794684678643381,    0.3239847771997537,    0.3239847771997537,    0.6740059517812944},\n\t{-0.3239847771997537,   -0.6740059517812944,   -0.3239847771997537,    0.5794684678643381},\n\t{-0.4004672082940195,   -0.7504883828755602,    0.15296486218853164,   0.5029860367700724},\n\t{ 0.15296486218853164,  -0.7504883828755602,   -0.4004672082940195,    0.5029860367700724},\n\t{ 0.08164729285680945,  -0.8828161875373585,    0.08164729285680945,   0.4553054119602712},\n\t{-0.08164729285680945,  -0.4553054119602712,   -0.08164729285680945,   0.8828161875373585},\n\t{-0.15296486218853164,  -0.5029860367700724,    0.4004672082940195,    0.7504883828755602},\n\t{ 0.4004672082940195,   -0.5029860367700724,   -0.15296486218853164,   0.7504883828755602},\n\t{ 0.3239847771997537,   -0.5794684678643381,    0.3239847771997537,    0.6740059517812944},\n\t{-0.3239847771997537,   -0.3239847771997537,   -0.6740059517812944,    0.5794684678643381},\n\t{-0.4004672082940195,    0.15296486218853164,  -0.7504883828755602,    0.5029860367700724},\n\t{ 0.15296486218853164,  -0.4004672082940195,   -0.7504883828755602,    0.5029860367700724},\n\t{ 0.08164729285680945,   0.08164729285680945,  -0.8828161875373585,    0.4553054119602712},\n\t{-0.08164729285680945,  -0.08164729285680945,  -0.4553054119602712,    0.8828161875373585},\n\t{-0.15296486218853164,   0.4004672082940195,   -0.5029860367700724,    0.7504883828755602},\n\t{ 0.4004672082940195,   -0.15296486218853164,  -0.5029860367700724,    0.7504883828755602},\n\t{ 0.3239847771997537,    0.3239847771997537,   -0.5794684678643381,    0.6740059517812944},\n\t{-0.6740059517812944,   -0.3239847771997537,    0.5794684678643381,   -0.3239847771997537},\n\t{-0.7504883828755602,   -0.4004672082940195,    0.5029860367700724,    0.15296486218853164},\n\t{-0.7504883828755602,    0.15296486218853164,   0.5029860367700724,   -0.4004672082940195},\n\t{-0.8828161875373585,    0.08164729285680945,   0.4553054119602712,    0.08164729285680945},\n\t{-0.4553054119602712,   -0.08164729285680945,   0.8828161875373585,   -0.08164729285680945},\n\t{-0.5029860367700724,   -0.15296486218853164,   0.7504883828755602,    0.4004672082940195},\n\t{-0.5029860367700724,    0.4004672082940195,    0.7504883828755602,   -0.15296486218853164},\n\t{-0.5794684678643381,    0.3239847771997537,    0.6740059517812944,    0.3239847771997537},\n\t{-0.3239847771997537,   -0.6740059517812944,    0.5794684678643381,   -0.3239847771997537},\n\t{-0.4004672082940195,   -0.7504883828755602,    0.5029860367700724,    0.15296486218853164},\n\t{ 0.15296486218853164,  -0.7504883828755602,    0.5029860367700724,   -0.4004672082940195},\n\t{ 0.08164729285680945,  -0.8828161875373585,    0.4553054119602712,    0.08164729285680945},\n\t{-0.08164729285680945,  -0.4553054119602712,    0.8828161875373585,   -0.08164729285680945},\n\t{-0.15296486218853164,  -0.5029860367700724,    0.7504883828755602,    0.4004672082940195},\n\t{ 0.4004672082940195,   -0.5029860367700724,    0.7504883828755602,   -0.15296486218853164},\n\t{ 0.3239847771997537,   -0.5794684678643381,    0.6740059517812944,    0.3239847771997537},\n\t{-0.3239847771997537,   -0.3239847771997537,    0.5794684678643381,   -0.6740059517812944},\n\t{-0.4004672082940195,    0.15296486218853164,   0.5029860367700724,   -0.7504883828755602},\n\t{ 0.15296486218853164,  -0.4004672082940195,    0.5029860367700724,   -0.7504883828755602},\n\t{ 0.08164729285680945,   0.08164729285680945,   0.4553054119602712,   -0.8828161875373585},\n\t{-0.08164729285680945,  -0.08164729285680945,   0.8828161875373585,   -0.4553054119602712},\n\t{-0.15296486218853164,   0.4004672082940195,    0.7504883828755602,   -0.5029860367700724},\n\t{ 0.4004672082940195,   -0.15296486218853164,   0.7504883828755602,   -0.5029860367700724},\n\t{ 0.3239847771997537,    0.3239847771997537,    0.6740059517812944,   -0.5794684678643381},\n\t{-0.6740059517812944,    0.5794684678643381,   -0.3239847771997537,   -0.3239847771997537},\n\t{-0.7504883828755602,    0.5029860367700724,   -0.4004672082940195,    0.15296486218853164},\n\t{-0.7504883828755602,    0.5029860367700724,    0.15296486218853164,  -0.4004672082940195},\n\t{-0.8828161875373585,    0.4553054119602712,    0.08164729285680945,   0.08164729285680945},\n\t{-0.4553054119602712,    0.8828161875373585,   -0.08164729285680945,  -0.08164729285680945},\n\t{-0.5029860367700724,    0.7504883828755602,   -0.15296486218853164,   0.4004672082940195},\n\t{-0.5029860367700724,    0.7504883828755602,    0.4004672082940195,   -0.15296486218853164},\n\t{-0.5794684678643381,    0.6740059517812944,    0.3239847771997537,    0.3239847771997537},\n\t{-0.3239847771997537,    0.5794684678643381,   -0.6740059517812944,   -0.3239847771997537},\n\t{-0.4004672082940195,    0.5029860367700724,   -0.7504883828755602,    0.15296486218853164},\n\t{ 0.15296486218853164,   0.5029860367700724,   -0.7504883828755602,   -0.4004672082940195},\n\t{ 0.08164729285680945,   0.4553054119602712,   -0.8828161875373585,    0.08164729285680945},\n\t{-0.08164729285680945,   0.8828161875373585,   -0.4553054119602712,   -0.08164729285680945},\n\t{-0.15296486218853164,   0.7504883828755602,   -0.5029860367700724,    0.4004672082940195},\n\t{ 0.4004672082940195,    0.7504883828755602,   -0.5029860367700724,   -0.15296486218853164},\n\t{ 0.3239847771997537,    0.6740059517812944,   -0.5794684678643381,    0.3239847771997537},\n\t{-0.3239847771997537,    0.5794684678643381,   -0.3239847771997537,   -0.6740059517812944},\n\t{-0.4004672082940195,    0.5029860367700724,    0.15296486218853164,  -0.7504883828755602},\n\t{ 0.15296486218853164,   0.5029860367700724,   -0.4004672082940195,   -0.7504883828755602},\n\t{ 0.08164729285680945,   0.4553054119602712,    0.08164729285680945,  -0.8828161875373585},\n\t{-0.08164729285680945,   0.8828161875373585,   -0.08164729285680945,  -0.4553054119602712},\n\t{-0.15296486218853164,   0.7504883828755602,    0.4004672082940195,   -0.5029860367700724},\n\t{ 0.4004672082940195,    0.7504883828755602,   -0.15296486218853164,  -0.5029860367700724},\n\t{ 0.3239847771997537,    0.6740059517812944,    0.3239847771997537,   -0.5794684678643381},\n\t{ 0.5794684678643381,   -0.6740059517812944,   -0.3239847771997537,   -0.3239847771997537},\n\t{ 0.5029860367700724,   -0.7504883828755602,   -0.4004672082940195,    0.15296486218853164},\n\t{ 0.5029860367700724,   -0.7504883828755602,    0.15296486218853164,  -0.4004672082940195},\n\t{ 0.4553054119602712,   -0.8828161875373585,    0.08164729285680945,   0.08164729285680945},\n\t{ 0.8828161875373585,   -0.4553054119602712,   -0.08164729285680945,  -0.08164729285680945},\n\t{ 0.7504883828755602,   -0.5029860367700724,   -0.15296486218853164,   0.4004672082940195},\n\t{ 0.7504883828755602,   -0.5029860367700724,    0.4004672082940195,   -0.15296486218853164},\n\t{ 0.6740059517812944,   -0.5794684678643381,    0.3239847771997537,    0.3239847771997537},\n\t{ 0.5794684678643381,   -0.3239847771997537,   -0.6740059517812944,   -0.3239847771997537},\n\t{ 0.5029860367700724,   -0.4004672082940195,   -0.7504883828755602,    0.15296486218853164},\n\t{ 0.5029860367700724,    0.15296486218853164,  -0.7504883828755602,   -0.4004672082940195},\n\t{ 0.4553054119602712,    0.08164729285680945,  -0.8828161875373585,    0.08164729285680945},\n\t{ 0.8828161875373585,   -0.08164729285680945,  -0.4553054119602712,   -0.08164729285680945},\n\t{ 0.7504883828755602,   -0.15296486218853164,  -0.5029860367700724,    0.4004672082940195},\n\t{ 0.7504883828755602,    0.4004672082940195,   -0.5029860367700724,   -0.15296486218853164},\n\t{ 0.6740059517812944,    0.3239847771997537,   -0.5794684678643381,    0.3239847771997537},\n\t{ 0.5794684678643381,   -0.3239847771997537,   -0.3239847771997537,   -0.6740059517812944},\n\t{ 0.5029860367700724,   -0.4004672082940195,    0.15296486218853164,  -0.7504883828755602},\n\t{ 0.5029860367700724,    0.15296486218853164,  -0.4004672082940195,   -0.7504883828755602},\n\t{ 0.4553054119602712,    0.08164729285680945,   0.08164729285680945,  -0.8828161875373585},\n\t{ 0.8828161875373585,   -0.08164729285680945,  -0.08164729285680945,  -0.4553054119602712},\n\t{ 0.7504883828755602,   -0.15296486218853164,   0.4004672082940195,   -0.5029860367700724},\n\t{ 0.7504883828755602,    0.4004672082940195,   -0.15296486218853164,  -0.5029860367700724},\n\t{ 0.6740059517812944,    0.3239847771997537,    0.3239847771997537,   -0.5794684678643381},\n\t{ 0.03381941603233842,   0.03381941603233842,   0.03381941603233842,   0.9982828964265062},\n\t{-0.044802370851755174, -0.044802370851755174,  0.508629699630796,     0.8586508742123365},\n\t{-0.044802370851755174,  0.508629699630796,    -0.044802370851755174,  0.8586508742123365},\n\t{-0.12128480194602098,   0.4321472685365301,    0.4321472685365301,    0.7821684431180708},\n\t{ 0.508629699630796,    -0.044802370851755174, -0.044802370851755174,  0.8586508742123365},\n\t{ 0.4321472685365301,   -0.12128480194602098,   0.4321472685365301,    0.7821684431180708},\n\t{ 0.4321472685365301,    0.4321472685365301,   -0.12128480194602098,   0.7821684431180708},\n\t{ 0.37968289875261624,   0.37968289875261624,   0.37968289875261624,   0.753341017856078},\n\t{ 0.03381941603233842,   0.03381941603233842,   0.9982828964265062,    0.03381941603233842},\n\t{-0.044802370851755174,  0.044802370851755174,  0.8586508742123365,    0.508629699630796},\n\t{-0.044802370851755174,  0.508629699630796,     0.8586508742123365,   -0.044802370851755174},\n\t{-0.12128480194602098,   0.4321472685365301,    0.7821684431180708,    0.4321472685365301},\n\t{ 0.508629699630796,    -0.044802370851755174,  0.8586508742123365,   -0.044802370851755174},\n\t{ 0.4321472685365301,   -0.12128480194602098,   0.7821684431180708,    0.4321472685365301},\n\t{ 0.4321472685365301,    0.4321472685365301,    0.7821684431180708,   -0.12128480194602098},\n\t{ 0.37968289875261624,   0.37968289875261624,   0.753341017856078,     0.37968289875261624},\n\t{ 0.03381941603233842,   0.9982828964265062,    0.03381941603233842,   0.03381941603233842},\n\t{-0.044802370851755174,  0.8586508742123365,   -0.044802370851755174,  0.508629699630796},\n\t{-0.044802370851755174,  0.8586508742123365,    0.508629699630796,    -0.044802370851755174},\n\t{-0.12128480194602098,   0.7821684431180708,    0.4321472685365301,    0.4321472685365301},\n\t{ 0.508629699630796,     0.8586508742123365,   -0.044802370851755174, -0.044802370851755174},\n\t{ 0.4321472685365301,    0.7821684431180708,   -0.12128480194602098,   0.4321472685365301},\n\t{ 0.4321472685365301,    0.7821684431180708,    0.4321472685365301,   -0.12128480194602098},\n\t{ 0.37968289875261624,   0.753341017856078,     0.37968289875261624,   0.37968289875261624},\n\t{ 0.9982828964265062,    0.03381941603233842,   0.03381941603233842,   0.03381941603233842},\n\t{ 0.8586508742123365,   -0.044802370851755174, -0.044802370851755174,  0.508629699630796},\n\t{ 0.8586508742123365,   -0.044802370851755174,  0.508629699630796,    -0.044802370851755174},\n\t{ 0.7821684431180708,   -0.12128480194602098,   0.4321472685365301,    0.4321472685365301},\n\t{ 0.8586508742123365,    0.508629699630796,    -0.044802370851755174, -0.044802370851755174},\n\t{ 0.7821684431180708,    0.4321472685365301,   -0.12128480194602098,   0.4321472685365301},\n\t{ 0.7821684431180708,    0.4321472685365301,    0.4321472685365301,   -0.12128480194602098},\n\t{ 0.753341017856078,     0.37968289875261624,   0.37968289875261624,   0.37968289875261624}\n};\n\n\nstatic void setup_gradients(void)\n{\n\tstatic int already_did = 0;\n\tint i;\n\n\tif (already_did)\n\t\treturn;\n\talready_did = 1;\n\n\tfor (i = 0; (size_t) i < ARRAYSIZE(grad2); i++) {\n\t\tgrad2[i].dx /= N2; grad2[i].dy /= N2;\n\t}\n\tfor (int i = 0; i < PSIZE; i++) {\n\t\tGRADIENTS_2D[i] = grad2[i % ARRAYSIZE(grad2)];\n\t}\n\n\tfor (i = 0; (size_t) i < ARRAYSIZE(grad3); i++) {\n\t\tgrad3[i].dx /= N3; grad3[i].dy /= N3; grad3[i].dz /= N3;\n\t}\n\tfor (i = 0; i < PSIZE; i++) {\n\t\tGRADIENTS_3D[i] = grad3[i % ARRAYSIZE(grad3)];\n\t}\n\n\tfor (i = 0; (size_t) i < ARRAYSIZE(grad4); i++) {\n\t\tgrad4[i].dx /= N4; grad4[i].dy /= N4; grad4[i].dz /= N4; grad4[i].dw /= N4;\n\t}\n\tfor (i = 0; i < PSIZE; i++) {\n\t\tGRADIENTS_4D[i] = grad4[i % ARRAYSIZE(grad4)];\n\t}\n}\n\nstatic void setup_lattice_points(void)\n{\n\tstatic int already_did = 0;\n\tint i;\n\n\tif (already_did)\n\t\treturn;\n\talready_did = 1;\n\n\tLOOKUP_2D[0] = new_LatticePoint2D(1, 0);\n\tLOOKUP_2D[1] = new_LatticePoint2D(0, 0);\n\tLOOKUP_2D[2] = new_LatticePoint2D(1, 1);\n\tLOOKUP_2D[3] = new_LatticePoint2D(0, 1);\n\n\tfor (i = 0; i < 8; i++) {\n\t\tint i1, j1, k1, i2, j2, k2;\n\t\ti1 = (i >> 0) & 1; j1 = (i >> 1) & 1; k1 = (i >> 2) & 1;\n\t\ti2 = i1 ^ 1; j2 = j1 ^ 1; k2 = k1 ^ 1;\n\n\t\t// The two points within this octant, one from each of the two cubic half-lattices.\n\t\tstruct LatticePoint3D *c0 = new_LatticePoint3D(i1, j1, k1, 0);\n\t\tstruct LatticePoint3D *c1 = new_LatticePoint3D(i1 + i2, j1 + j2, k1 + k2, 1);\n\n\t\t// Each single step away on the first half-lattice.\n\t\tstruct LatticePoint3D *c2 = new_LatticePoint3D(i1 ^ 1, j1, k1, 0);\n\t\tstruct LatticePoint3D *c3 = new_LatticePoint3D(i1, j1 ^ 1, k1, 0);\n\t\tstruct LatticePoint3D *c4 = new_LatticePoint3D(i1, j1, k1 ^ 1, 0);\n\n\t\t// Each single step away on the second half-lattice.\n\t\tstruct LatticePoint3D *c5 = new_LatticePoint3D(i1 + (i2 ^ 1), j1 + j2, k1 + k2, 1);\n\t\tstruct LatticePoint3D *c6 = new_LatticePoint3D(i1 + i2, j1 + (j2 ^ 1), k1 + k2, 1);\n\t\tstruct LatticePoint3D *c7 = new_LatticePoint3D(i1 + i2, j1 + j2, k1 + (k2 ^ 1), 1);\n\n\t\t// First two are guaranteed.\n\t\tc0->nextOnFailure = c0->nextOnSuccess = c1;\n\t\tc1->nextOnFailure = c1->nextOnSuccess = c2;\n\n\t\t// Once we find one on the first half-lattice, the rest are out.\n\t\t// In addition, knowing c2 rules out c5.\n\t\tc2->nextOnFailure = c3; c2->nextOnSuccess = c6;\n\t\tc3->nextOnFailure = c4; c3->nextOnSuccess = c5;\n\t\tc4->nextOnFailure = c4->nextOnSuccess = c5;\n\n\t\t// Once we find one on the second half-lattice, the rest are out.\n\t\tc5->nextOnFailure = c6; c5->nextOnSuccess = NULL;\n\t\tc6->nextOnFailure = c7; c6->nextOnSuccess = NULL;\n\t\tc7->nextOnFailure = c7->nextOnSuccess = NULL;\n\n\t\tLOOKUP_3D[i] = c0;\n\t}\n\n\tfor (i = 0; i < 16; i++) {\n\t\tVERTICES_4D[i] = new_LatticePoint4D((i >> 0) & 1, (i >> 1) & 1, (i >> 2) & 1, (i >> 3) & 1);\n\t}\n}\n\n/* Free up all the LatticePoint stuff allocated in setup_lattice_points() */\nvoid OpenSimplex2F_shutdown(void)\n{\n\tint i;\n\tstruct LatticePoint3D *list[8];\n\tint count = 0;\n\n\tfor (i = 0; (size_t) i < ARRAYSIZE(LOOKUP_2D); i++) {\n\t\tif (LOOKUP_2D[i]) {\n\t\t\tfree(LOOKUP_2D[i]);\n\t\t\tLOOKUP_2D[i] = NULL;\n\t\t}\n\t}\n\n\tfor (i = 0; (size_t) i < ARRAYSIZE(LOOKUP_3D); i++) {\n\t\tif (LOOKUP_3D[i]) {\n\t\t\t/* There are cycles in the tree LOOKUP_3D[i], so we have to\n\t\t\t * make a list of unique pointers within the tree to free them. \n\t\t\t * We know there are only 8 unique pointers in the tree.\n\t\t\t */\n\t\t\tcount = 0;\n\t\t\tmemset(list, 0, sizeof(list));\n\t\t\tfind_unique_pointers(LOOKUP_3D[i], list, &count);\n\t\t\tfree_LatticePoint3D(list, count);\n\t\t\tLOOKUP_3D[i] = NULL;\n\t\t}\n\t}\n\n\tfor (i = 0; (size_t) i < ARRAYSIZE(VERTICES_4D); i++) {\n\t\tif (VERTICES_4D[i]) {\n\t\t\tfree(VERTICES_4D[i]);\n\t\t\tVERTICES_4D[i] = NULL;\n\t\t}\n\t}\n}\n\nvoid OpenSimplex2F_free(struct OpenSimplex2F_context *ctx)\n{\n\tif (ctx->perm)\n\t\tfree(ctx->perm);\n\tif (ctx->permGrad2)\n\t\tfree(ctx->permGrad2);\n\tif (ctx->permGrad3)\n\t\tfree(ctx->permGrad3);\n\tif (ctx->permGrad4)\n\t\tfree(ctx->permGrad4);\n\tfree(ctx);\n}\n\nint OpenSimplex2F(int64_t seed, struct OpenSimplex2F_context **ctx)\n{\n\tstruct OpenSimplex2F_context *c;\n\tint i, *source;\n\n\tsetup_gradients();\n\tsetup_lattice_points();\n\n\tsource = calloc(1, sizeof(*source) * PSIZE);\n\tif (!source)\n\t\treturn -1;\n\n\tc = calloc(1, sizeof(**ctx));\n\tif (!c) {\n\t\tfree(source);\n\t\treturn -1;\n\t}\n\t*ctx = c;\n\n\tc->perm = calloc(1, sizeof(*c->perm) * PSIZE);\n\tc->permGrad2 = calloc(1, sizeof(*c->permGrad2) * PSIZE);\n\tc->permGrad3 = calloc(1, sizeof(*c->permGrad3) * PSIZE);\n\tc->permGrad4 = calloc(1, sizeof(*c->permGrad4) * PSIZE);\n\n\tif (!c->perm || !c->permGrad2 || !c->permGrad3 || !c->permGrad4) {\n\t\tOpenSimplex2F_free(*ctx);\n\t\t*ctx = NULL;\n\t\tfree(source);\n\t\treturn -1;\n\t}\n\n\tfor (i = 0; i < PSIZE; i++)\n\t\tsource[i] = (int16_t) i;\n\n\tfor (int i = PSIZE - 1; i >= 0; i--) {\n\t\tseed = (uint64_t) seed * (uint64_t) 6364136223846793005LL + (uint64_t) 1442695040888963407LL;\n\t\tint r = (int)((seed + 31) % (i + 1));\n\t\tif (r < 0)\n\t\t\tr += (i + 1);\n\t\tc->perm[i] = source[r];\n\t\tc->permGrad2[i] = GRADIENTS_2D[c->perm[i]];\n\t\tc->permGrad3[i] = GRADIENTS_3D[c->perm[i]];\n\t\tc->permGrad4[i] = GRADIENTS_4D[c->perm[i]];\n\t\tsource[r] = source[i];\n\t}\n\tfree(source);\n\treturn 0;\n}\n\nstatic int fastFloor(double x)\n{\n\tint xi = (int)x;\n\treturn x < xi ? xi - 1 : xi;\n}\n\n/*\n * 2D Simplex noise base.\n * Lookup table implementation inspired by DigitalShadow.\n */\nstatic double noise2_Base(struct OpenSimplex2F_context *ctx, double xs, double ys)\n{\n\tdouble value = 0;\n\tint i;\n\n\t// Get base points and offsets\n\tint xsb = fastFloor(xs), ysb = fastFloor(ys);\n\tdouble xsi = xs - xsb, ysi = ys - ysb;\n\n\t// Index to point list\n\tint index = (int)((ysi - xsi) / 2 + 1);\n\n\tdouble ssi = (xsi + ysi) * -0.211324865405187;\n\tdouble xi = xsi + ssi, yi = ysi + ssi;\n\n\t// Point contributions\n\tfor (i = 0; i < 3; i++) {\n\t\tstruct LatticePoint2D c = *(LOOKUP_2D[index + i]);\n\n\t\tdouble dx = xi + c.dx, dy = yi + c.dy;\n\t\tdouble attn = 0.5 - dx * dx - dy * dy;\n\t\tif (attn <= 0) continue;\n\n\t\tint pxm = (xsb + c.xsv) & PMASK, pym = (ysb + c.ysv) & PMASK;\n\t\tstruct Grad2 grad = ctx->permGrad2[ctx->perm[pxm] ^ pym];\n\t\tdouble extrapolation = grad.dx * dx + grad.dy * dy;\n\n\t\tattn *= attn;\n\t\tvalue += attn * attn * extrapolation;\n\t}\n\n\treturn value;\n}\n\n/**\n * Generate overlapping cubic lattices for 3D Re-oriented BCC noise.\n * Lookup table implementation inspired by DigitalShadow.\n * It was actually faster to narrow down the points in the loop itself,\n * than to build up the index with enough info to isolate 4 points.\n */\nstatic double noise3_BCC(struct OpenSimplex2F_context *ctx, double xr, double yr, double zr)\n{\n\t// Get base and offsets inside cube of first lattice.\n\tint xrb = fastFloor(xr), yrb = fastFloor(yr), zrb = fastFloor(zr);\n\tdouble xri = xr - xrb, yri = yr - yrb, zri = zr - zrb;\n\n\t// Identify which octant of the cube we're in. This determines which cell\n\t// in the other cubic lattice we're in, and also narrows down one point on each.\n\tint xht = (int)(xri + 0.5), yht = (int)(yri + 0.5), zht = (int)(zri + 0.5);\n\tint index = (xht << 0) | (yht << 1) | (zht << 2);\n\n\t// Point contributions\n\tdouble value = 0;\n\tstruct LatticePoint3D *c = LOOKUP_3D[index];\n\twhile (c != NULL) {\n\t\tdouble dxr = xri + c->dxr, dyr = yri + c->dyr, dzr = zri + c->dzr;\n\t\tdouble attn = 0.5 - dxr * dxr - dyr * dyr - dzr * dzr;\n\t\tif (attn < 0) {\n\t\t\tc = c->nextOnFailure;\n\t\t} else {\n\t\t\tint pxm = (xrb + c->xrv) & PMASK, pym = (yrb + c->yrv) & PMASK, pzm = (zrb + c->zrv) & PMASK;\n\t\t\tstruct Grad3 grad = ctx->permGrad3[ctx->perm[ctx->perm[pxm] ^ pym] ^ pzm];\n\t\t\tdouble extrapolation = grad.dx * dxr + grad.dy * dyr + grad.dz * dzr;\n\n\t\t\tattn *= attn;\n\t\t\tvalue += attn * attn * extrapolation;\n\t\t\tc = c->nextOnSuccess;\n\t\t}\n\t}\n\treturn value;\n}\n\n/**\n * 2D Simplex noise, standard lattice orientation.\n */\ndouble OpenSimplex2F_noise2(struct OpenSimplex2F_context *ctx, double x, double y)\n{\n\t// Get points for A2* lattice\n\tdouble s = 0.366025403784439 * (x + y);\n\tdouble xs = x + s, ys = y + s;\n\n\treturn noise2_Base(ctx, xs, ys);\n}\n\n/**\n * 2D Simplex noise, with Y pointing down the main diagonal.\n * Might be better for a 2D sandbox style game, where Y is vertical.\n * Probably slightly less optimal for heightmaps or continent maps.\n */\ndouble OpenSimplex2F_noise2_XBeforeY(struct OpenSimplex2F_context *ctx, double x, double y)\n{\n\t// Skew transform and rotation baked into one.\n\tdouble xx = x * 0.7071067811865476;\n\tdouble yy = y * 1.224744871380249;\n\n\treturn noise2_Base(ctx, yy + xx, yy - xx);\n}\n\n/**\n * 3D Re-oriented 4-point BCC noise, classic orientation.\n * Proper substitute for 3D Simplex in light of Forbidden Formulae.\n * Use noise3_XYBeforeZ or noise3_XZBeforeY instead, wherever appropriate.\n */\ndouble OpenSimplex2F_noise3_Classic(struct OpenSimplex2F_context *ctx, double x, double y, double z)\n{\n\t// Re-orient the cubic lattices via rotation, to produce the expected look on cardinal planar slices.\n\t// If texturing objects that don't tend to have cardinal plane faces, you could even remove this.\n\t// Orthonormal rotation. Not a skew transform.\n\tdouble r = (2.0 / 3.0) * (x + y + z);\n\tdouble xr = r - x, yr = r - y, zr = r - z;\n\n\t// Evaluate both lattices to form a BCC lattice.\n\treturn noise3_BCC(ctx, xr, yr, zr);\n}\n\n/**\n * 3D Re-oriented 4-point BCC noise, with better visual isotropy in (X, Y).\n * Recommended for 3D terrain and time-varied animations.\n * The Z coordinate should always be the \"different\" coordinate in your use case.\n * If Y is vertical in world coordinates, call noise3_XYBeforeZ(x, z, Y) or use noise3_XZBeforeY.\n * If Z is vertical in world coordinates, call noise3_XYBeforeZ(x, y, Z).\n * For a time varied animation, call noise3_XYBeforeZ(x, y, T).\n */\ndouble OpenSimplex2F_noise3_XYBeforeZ(struct OpenSimplex2F_context *ctx, double x, double y, double z)\n{\n\t// Re-orient the cubic lattices without skewing, to make X and Y triangular like 2D.\n\t// Orthonormal rotation. Not a skew transform.\n\tdouble xy = x + y;\n\tdouble s2 = xy * -0.211324865405187;\n\tdouble zz = z * 0.577350269189626;\n\tdouble xr = x + s2 - zz, yr = y + s2 - zz;\n\tdouble zr = xy * 0.577350269189626 + zz;\n\n\t// Evaluate both lattices to form a BCC lattice.\n\treturn noise3_BCC(ctx, xr, yr, zr);\n}\n\n/**\n * 3D Re-oriented 4-point BCC noise, with better visual isotropy in (X, Z).\n * Recommended for 3D terrain and time-varied animations.\n * The Y coordinate should always be the \"different\" coordinate in your use case.\n * If Y is vertical in world coordinates, call noise3_XZBeforeY(x, Y, z).\n * If Z is vertical in world coordinates, call noise3_XZBeforeY(x, Z, y) or use noise3_XYBeforeZ.\n * For a time varied animation, call noise3_XZBeforeY(x, T, y) or use noise3_XYBeforeZ.\n */\ndouble OpenSimplex2F_noise3_XZBeforeY(struct OpenSimplex2F_context *ctx, double x, double y, double z)\n{\n\t// Re-orient the cubic lattices without skewing, to make X and Z triangular like 2D.\n\t// Orthonormal rotation. Not a skew transform.\n\tdouble xz = x + z;\n\tdouble s2 = xz * -0.211324865405187;\n\tdouble yy = y * 0.577350269189626;\n\tdouble xr = x + s2 - yy; double zr = z + s2 - yy;\n\tdouble yr = xz * 0.577350269189626 + yy;\n\n\t// Evaluate both lattices to form a BCC lattice.\n\treturn noise3_BCC(ctx, xr, yr, zr);\n}\n\n/**\n * 4D OpenSimplex2F noise base.\n * Current implementation not fully optimized by lookup tables.\n * But still comes out slightly ahead of Gustavson's Simplex in tests.\n */\nstatic double noise4_Base(struct OpenSimplex2F_context *ctx, double xs, double ys, double zs, double ws)\n{\n\tdouble value = 0;\n\n\t// Get base points and offsets\n\tint xsb = fastFloor(xs), ysb = fastFloor(ys), zsb = fastFloor(zs), wsb = fastFloor(ws);\n\tdouble xsi = xs - xsb, ysi = ys - ysb, zsi = zs - zsb, wsi = ws - wsb;\n\n\t// If we're in the lower half, flip so we can repeat the code for the upper half. We'll flip back later.\n\tdouble siSum = xsi + ysi + zsi + wsi;\n\tdouble ssi = siSum * 0.309016994374947; // Prep for vertex contributions.\n\tbool inLowerHalf = (siSum < 2);\n\tif (inLowerHalf) {\n\t\txsi = 1 - xsi; ysi = 1 - ysi; zsi = 1 - zsi; wsi = 1 - wsi;\n\t\tsiSum = 4 - siSum;\n\t}\n\n\t// Consider opposing vertex pairs of the octahedron formed by the central cross-section of the stretched tesseract\n\tdouble aabb = xsi + ysi - zsi - wsi, abab = xsi - ysi + zsi - wsi, abba = xsi - ysi - zsi + wsi;\n\tdouble aabbScore = fabs(aabb), ababScore = fabs(abab), abbaScore = fabs(abba);\n\n\t// Find the closest point on the stretched tesseract as if it were the upper half\n\tint vertexIndex, via, vib;\n\tdouble asi, bsi;\n\tif (aabbScore > ababScore && aabbScore > abbaScore) {\n\t\tif (aabb > 0) {\n\t\t\tasi = zsi; bsi = wsi; vertexIndex = B0011; via = B0111; vib = B1011;\n\t\t} else {\n\t\t\tasi = xsi; bsi = ysi; vertexIndex = B1100; via = B1101; vib = B1110;\n\t\t}\n\t} else if (ababScore > abbaScore) {\n\t\tif (abab > 0) {\n\t\t\tasi = ysi; bsi = wsi; vertexIndex = B0101; via = B0111; vib = B1101;\n\t\t} else {\n\t\t\tasi = xsi; bsi = zsi; vertexIndex = B1010; via = B1011; vib = B1110;\n\t\t}\n\t} else {\n\t\tif (abba > 0) {\n\t\t\tasi = ysi; bsi = zsi; vertexIndex = B1001; via = B1011; vib = B1101;\n\t\t} else {\n\t\t\tasi = xsi; bsi = wsi; vertexIndex = B0110; via = B0111; vib = B1110;\n\t\t}\n\t}\n\tif (bsi > asi) {\n\t\tvia = vib;\n\t\tdouble temp = bsi;\n\t\tbsi = asi;\n\t\tasi = temp;\n\t}\n\tif (siSum + asi > 3) {\n\t\tvertexIndex = via;\n\t\tif (siSum + bsi > 4) {\n\t\t\tvertexIndex = B1111;\n\t\t}\n\t}\n\n\t// Now flip back if we're actually in the lower half.\n\tif (inLowerHalf) {\n\t\txsi = 1 - xsi; ysi = 1 - ysi; zsi = 1 - zsi; wsi = 1 - wsi;\n\t\tvertexIndex ^= B1111;\n\t}\n\n\t// Five points to add, total, from five copies of the A4 lattice.\n\tfor (int i = 0; i < 5; i++) {\n\n\t\t// Update xsb/etc. and add the lattice point's contribution.\n\t\tstruct LatticePoint4D c = *(VERTICES_4D[vertexIndex]);\n\t\txsb += c.xsv; ysb += c.ysv; zsb += c.zsv; wsb += c.wsv;\n\t\tdouble xi = xsi + ssi, yi = ysi + ssi, zi = zsi + ssi, wi = wsi + ssi;\n\t\tdouble dx = xi + c.dx, dy = yi + c.dy, dz = zi + c.dz, dw = wi + c.dw;\n\t\tdouble attn = 0.5 - dx * dx - dy * dy - dz * dz - dw * dw;\n\t\tif (attn > 0) {\n\t\t\tint pxm = xsb & PMASK, pym = ysb & PMASK, pzm = zsb & PMASK, pwm = wsb & PMASK;\n\t\t\tstruct Grad4 grad = ctx->permGrad4[ctx->perm[ctx->perm[ctx->perm[pxm] ^ pym] ^ pzm] ^ pwm];\n\t\t\tdouble ramped = grad.dx * dx + grad.dy * dy + grad.dz * dz + grad.dw * dw;\n\n\t\t\tattn *= attn;\n\t\t\tvalue += attn * attn * ramped;\n\t\t}\n\n\t\t// Maybe this helps the compiler/JVM/LLVM/etc. know we can end the loop here. Maybe not.\n\t\tif (i == 4) break;\n\n\t\t// Update the relative skewed coordinates to reference the vertex we just added.\n\t\t// Rather, reference its counterpart on the lattice copy that is shifted down by\n\t\t// the vector <-0.2, -0.2, -0.2, -0.2>\n\t\txsi += c.xsi; ysi += c.ysi; zsi += c.zsi; wsi += c.wsi;\n\t\tssi += c.ssiDelta;\n\n\t\t// Next point is the closest vertex on the 4-simplex whose base vertex is the aforementioned vertex.\n\t\tdouble score0 = 1.0 + ssi * (-1.0 / 0.309016994374947); // Seems slightly faster than 1.0-xsi-ysi-zsi-wsi\n\t\tvertexIndex = B0000;\n\t\tif (xsi >= ysi && xsi >= zsi && xsi >= wsi && xsi >= score0) {\n\t\t\tvertexIndex = B0001;\n\t\t}\n\t\telse if (ysi > xsi && ysi >= zsi && ysi >= wsi && ysi >= score0) {\n\t\t\tvertexIndex = B0010;\n\t\t}\n\t\telse if (zsi > xsi && zsi > ysi && zsi >= wsi && zsi >= score0) {\n\t\t\tvertexIndex = B0100;\n\t\t}\n\t\telse if (wsi > xsi && wsi > ysi && wsi > zsi && wsi >= score0) {\n\t\t\tvertexIndex = B1000;\n\t\t}\n\t}\n\n\treturn value;\n}\n\n/**\n * 4D OpenSimplex2F noise, classic lattice orientation.\n */\n double OpenSimplex2F_noise4_Classic(struct OpenSimplex2F_context *ctx, double x, double y, double z, double w)\n{\n\t// Get points for A4 lattice\n\tdouble s = -0.138196601125011 * (x + y + z + w);\n\tdouble xs = x + s, ys = y + s, zs = z + s, ws = w + s;\n\n\treturn noise4_Base(ctx, xs, ys, zs, ws);\n}\n\n/**\n * 4D OpenSimplex2F noise, with XY and ZW forming orthogonal triangular-based planes.\n * Recommended for 3D terrain, where X and Y (or Z and W) are horizontal.\n * Recommended for noise(x, y, sin(time), cos(time)) trick.\n */\ndouble OpenSimplex2F_noise4_XYBeforeZW(struct OpenSimplex2F_context *ctx, double x, double y, double z, double w)\n{\n\n\tdouble s2 = (x + y) * -0.178275657951399372 + (z + w) * 0.215623393288842828;\n\tdouble t2 = (z + w) * -0.403949762580207112 + (x + y) * -0.375199083010075342;\n\tdouble xs = x + s2, ys = y + s2, zs = z + t2, ws = w + t2;\n\n\treturn noise4_Base(ctx, xs, ys, zs, ws);\n}\n\n/**\n * 4D OpenSimplex2F noise, with XZ and YW forming orthogonal triangular-based planes.\n * Recommended for 3D terrain, where X and Z (or Y and W) are horizontal.\n */\ndouble OpenSimplex2F_noise4_XZBeforeYW(struct OpenSimplex2F_context *ctx, double x, double y, double z, double w)\n{\n\tdouble s2 = (x + z) * -0.178275657951399372 + (y + w) * 0.215623393288842828;\n\tdouble t2 = (y + w) * -0.403949762580207112 + (x + z) * -0.375199083010075342;\n\tdouble xs = x + s2, ys = y + t2, zs = z + s2, ws = w + t2;\n\n\treturn noise4_Base(ctx, xs, ys, zs, ws);\n}\n\n/**\n * 4D OpenSimplex2F noise, with XYZ oriented like noise3_Classic,\n * and W for an extra degree of freedom. W repeats eventually.\n * Recommended for time-varied animations which texture a 3D object (W=time)\n */\ndouble OpenSimplex2F_noise4_XYZBeforeW(struct OpenSimplex2F_context *ctx, double x, double y, double z, double w)\n{\n\tdouble xyz = x + y + z;\n\tdouble ww = w * 0.2236067977499788;\n\tdouble s2 = xyz * -0.16666666666666666 + ww;\n\tdouble xs = x + s2, ys = y + s2, zs = z + s2, ws = -0.5 * xyz + ww;\n\n\treturn noise4_Base(ctx, xs, ys, zs, ws);\n}\n\n"
  },
  {
    "path": "_old/c/OpenSimplex2F.h",
    "content": "#ifndef OpenSimplex2F_h__\n#define OpenSimplex2F_h__\n\n/**\n * K.jpg's OpenSimplex 2, faster variant\n *\n * - 2D is standard simplex implemented using a lookup table.\n * - 3D is \"Re-oriented 4-point BCC noise\" which constructs a\n *   congruent BCC lattice in a much different way than usual.\n * - 4D constructs the lattice as a union of five copies of its\n *   reciprocal. It successively finds the closest point on each.\n *\n * Multiple versions of each function are provided. See the\n * documentation above each, for more info.\n *\n * Ported from Java to C by Stephen M. Cameron\n *\n */\n\n#if ((__GNUC_STDC_INLINE__) || (__STDC_VERSION__ >= 199901L))\n\t#include <stdint.h>\n\t#define INLINE inline\n#elif (defined (_MSC_VER) || defined (__GNUC_GNU_INLINE__))\n\t#include <stdint.h>\n\t#define INLINE __inline\n#else\n\t/* ANSI C doesn't have inline or stdint.h. */\n\t#define INLINE\n#endif\n\n#ifdef __cplusplus\n\textern \"C\" {\n#endif\n\nstruct OpenSimplex2F_context;\n\n/* Allocate and initialize OpenSimplex2F context */\nint OpenSimplex2F(int64_t seed, struct OpenSimplex2F_context **ctx);\n\n/* Free OpenSimplex2F context */\nvoid OpenSimplex2F_free(struct OpenSimplex2F_context * ctx);\n\n/* Free singleton lattice point data */\nvoid OpenSimplex2F_shutdown(void);\n\n/**\n * 2D Simplex noise, standard lattice orientation.\n */\ndouble OpenSimplex2F_noise2(struct OpenSimplex2F_context *ctx, double x, double y);\n\n/**\n * 2D Simplex noise, with Y pointing down the main diagonal.\n * Might be better for a 2D sandbox style game, where Y is vertical.\n * Probably slightly less optimal for heightmaps or continent maps.\n */\ndouble OpenSimplex2F_noise2_XBeforeY(struct OpenSimplex2F_context *ctx, double x, double y);\n\n/**\n * 3D Re-oriented 4-point BCC noise, classic orientation.\n * Proper substitute for 3D Simplex in light of Forbidden Formulae.\n * Use noise3_XYBeforeZ or noise3_XZBeforeY instead, wherever appropriate.\n */\ndouble OpenSimplex2F_noise3_Classic(struct OpenSimplex2F_context *ctx, double x, double y, double z);\n\n/**\n * 3D Re-oriented 4-point BCC noise, with better visual isotropy in (X, Y).\n * Recommended for 3D terrain and time-varied animations.\n * The Z coordinate should always be the \"different\" coordinate in your use case.\n * If Y is vertical in world coordinates, call noise3_XYBeforeZ(x, z, Y) or use noise3_XZBeforeY.\n * If Z is vertical in world coordinates, call noise3_XYBeforeZ(x, y, Z).\n * For a time varied animation, call noise3_XYBeforeZ(x, y, T).\n */\ndouble OpenSimplex2F_noise3_XYBeforeZ(struct OpenSimplex2F_context *ctx, double x, double y, double z);\n\n/**\n * 3D Re-oriented 4-point BCC noise, with better visual isotropy in (X, Z).\n * Recommended for 3D terrain and time-varied animations.\n * The Y coordinate should always be the \"different\" coordinate in your use case.\n * If Y is vertical in world coordinates, call noise3_XZBeforeY(x, Y, z).\n * If Z is vertical in world coordinates, call noise3_XZBeforeY(x, Z, y) or use noise3_XYBeforeZ.\n * For a time varied animation, call noise3_XZBeforeY(x, T, y) or use noise3_XYBeforeZ.\n */\ndouble OpenSimplex2F_noise3_XZBeforeY(struct OpenSimplex2F_context *ctx, double x, double y, double z);\n\n/**\n * 4D OpenSimplex2F noise, classic lattice orientation.\n */\ndouble OpenSimplex2F_noise4_Classic(struct OpenSimplex2F_context *ctx, double x, double y, double z, double w);\n\n/**\n * 4D OpenSimplex2F noise, with XY and ZW forming orthogonal triangular-based planes.\n * Recommended for 3D terrain, where X and Y (or Z and W) are horizontal.\n * Recommended for noise(x, y, sin(time), cos(time)) trick.\n */\ndouble OpenSimplex2F_noise4_XYBeforeZW(struct OpenSimplex2F_context *ctx, double x, double y, double z, double w);\n\n/**\n * 4D OpenSimplex2F noise, with XZ and YW forming orthogonal triangular-based planes.\n * Recommended for 3D terrain, where X and Z (or Y and W) are horizontal.\n */\ndouble OpenSimplex2F_noise4_XZBeforeYW(struct OpenSimplex2F_context *ctx, double x, double y, double z, double w);\n\n/**\n * 4D OpenSimplex2F noise, with XYZ oriented like noise3_Classic,\n * and W for an extra degree of freedom. W repeats eventually.\n * Recommended for time-varied animations which texture a 3D object (W=time)\n */\ndouble OpenSimplex2F_noise4_XYZBeforeW(struct OpenSimplex2F_context *ctx, double x, double y, double z, double w);\n\n#ifdef __cplusplus\n\t}\n#endif\n\n#endif\n\n"
  },
  {
    "path": "_old/c/UNLICENSE",
    "content": "This is free and unencumbered software released into the public domain.\n\nAnyone is free to copy, modify, publish, use, compile, sell, or\ndistribute this software, either in source code form or as a compiled\nbinary, for any purpose, commercial or non-commercial, and by any\nmeans.\n\nIn jurisdictions that recognize copyright laws, the author or authors\nof this software dedicate any and all copyright interest in the\nsoftware to the public domain. We make this dedication for the benefit\nof the public at large and to the detriment of our heirs and\nsuccessors. We intend this dedication to be an overt act of\nrelinquishment in perpetuity of all present and future rights to this\nsoftware under copyright law.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR\nOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\nFor more information, please refer to <https://unlicense.org>\n"
  },
  {
    "path": "_old/c/test_OpenSimplex2F.c",
    "content": "#include <stdio.h>\n#if ((__STDC_VERSION__ >= 199901L) || (_MSC_VER))\n\t#include <stdint.h>\n#endif\n#include <string.h>\n#include <errno.h>\n\n#include <png.h>\n\n#include \"OpenSimplex2F.h\"\n\n#define WIDTH 512\n#define HEIGHT 512\n#define FEATURE_SIZE 24\n\nstatic int write_png_image(const char *filename, unsigned char *pixels, int w, int h, int has_alpha)\n{\n\tpng_structp png_ptr;\n\tpng_infop info_ptr;\n\tpng_byte **row;\n\tint x, y, rc, colordepth = 8;\n\tint bytes_per_pixel = has_alpha ? 4 : 3;\n\tFILE *f;\n\n\tf = fopen(filename, \"w\");\n\tif (!f) {\n\t\tfprintf(stderr, \"fopen: %s:%s\\n\", filename, strerror(errno));\n\t\treturn -1;\n\t}\n\tpng_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);\n\tif (!png_ptr)\n\t\tgoto cleanup1;\n\tinfo_ptr = png_create_info_struct(png_ptr);\n\tif (!info_ptr)\n\t\tgoto cleanup2;\n\tif (setjmp(png_jmpbuf(png_ptr))) /* oh libpng, you're old as dirt, aren't you. */\n\t\tgoto cleanup2;\n\n\tpng_set_IHDR(png_ptr, info_ptr, (size_t) w, (size_t) h, colordepth,\n\t\t\thas_alpha ? PNG_COLOR_TYPE_RGBA : PNG_COLOR_TYPE_RGB,\n\t\t\tPNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,\n\t\t\tPNG_FILTER_TYPE_DEFAULT);\n\n\trow = png_malloc(png_ptr, h * sizeof(*row));\n\tfor (y = 0; y < h; y++) {\n\t\trow[y] = png_malloc(png_ptr, w * bytes_per_pixel);\n\t\tfor (x = 0; x < w; x++) {\n\t\t\tunsigned char *r = (unsigned char *) row[y];\n\t\t\tunsigned char *src = (unsigned char *)\n\t\t\t\t&pixels[y * w * bytes_per_pixel + x * bytes_per_pixel];\n\t\t\tunsigned char *dest = &r[x * bytes_per_pixel];\n\t\t\tmemcpy(dest, src, bytes_per_pixel);\n\t\t}\n\t}\n\n\tpng_init_io(png_ptr, f);\n\tpng_set_rows(png_ptr, info_ptr, row);\n\tpng_write_png(png_ptr, info_ptr, PNG_TRANSFORM_PACKING, NULL);\n\n\tfor (y = 0; y < h; y++)\n\t\tpng_free(png_ptr, row[y]);\n\tpng_free(png_ptr, row);\n\trc = 0;\ncleanup2:\n\tpng_destroy_write_struct(&png_ptr, &info_ptr);\ncleanup1:\n\tfclose(f);\n\treturn rc;\n}\n\nint main(__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])\n{\n\tint x, y;\n\tdouble value;\n\tdouble v0, v1, v2; /* values from different octaves. */\n\tuint32_t rgb;\n\tuint32_t image2d[HEIGHT][WIDTH];\n\tuint32_t image3d[HEIGHT][WIDTH];\n\tuint32_t image4d[HEIGHT][WIDTH];\n\tstruct OpenSimplex2F_context *ctx;\n\n\tOpenSimplex2F(77374, &ctx);\n\n\tfor (y = 0; y < HEIGHT; y++) {\n\t\tfor (x = 0; x < WIDTH; x++) {\n#if defined(SINGLE_OCTAVE)\n\t\t\tvalue = open_simplex_noise4(ctx, (double) x / FEATURE_SIZE, (double) y / FEATURE_SIZE, 0.0, 0.0);\n#else\n\t\t\t/* Use three octaves: frequency N, N/2 and N/4 with relative amplitudes 4:2:1. */\n\t\t\tv0 = OpenSimplex2F_noise4_Classic(ctx, (double) x / FEATURE_SIZE / 4,\n\t\t\t\t\t\t(double) y / FEATURE_SIZE / 4, 0.0, 0.0);\n\t\t\tv1 = OpenSimplex2F_noise4_Classic(ctx, (double) x / FEATURE_SIZE / 2,\n\t\t\t\t\t\t(double) y / FEATURE_SIZE / 2, 0.0, 0.0);\n\t\t\tv2 = OpenSimplex2F_noise4_Classic(ctx, (double) x / FEATURE_SIZE / 1,\n\t\t\t\t\t\t(double) y / FEATURE_SIZE / 1, 0.0, 0.0);\n\t\t\tvalue = v0 * 4 / 7.0 + v1 * 2 / 7.0 + v2 * 1 / 7.0;\n#endif\n\t\t\trgb = 0x010101 * (uint32_t) ((value + 1) * 127.5);\n\t\t\timage2d[y][x] = ((uint32_t) 0x0ff << 24) | (rgb);\n\n\t\t\tvalue = OpenSimplex2F_noise2(ctx, (double) x / FEATURE_SIZE, (double) y / FEATURE_SIZE);\n\t\t\trgb = 0x010101 * (uint32_t) ((value + 1) * 127.5);\n\t\t\timage3d[y][x] = ((uint32_t) 0x0ff << 24) | (rgb);\n\n\t\t\tvalue = OpenSimplex2F_noise3_Classic(ctx, (double) x / FEATURE_SIZE, (double) y / FEATURE_SIZE, 0.0);\n\t\t\trgb = 0x010101 * (uint32_t) ((value + 1) * 127.5);\n\t\t\timage4d[y][x] = ((uint32_t) 0x0ff << 24) | (rgb);\n\t\t}\n\t}\n\twrite_png_image(\"test2d.png\", (unsigned char *) image2d, WIDTH, HEIGHT, 1);\n\twrite_png_image(\"test3d.png\", (unsigned char *) image3d, WIDTH, HEIGHT, 1);\n\twrite_png_image(\"test4d.png\", (unsigned char *) image4d, WIDTH, HEIGHT, 1);\n\tOpenSimplex2F_free(ctx);\n\tOpenSimplex2F_shutdown();\n\treturn 0;\n}\n\n"
  },
  {
    "path": "_old/cpp/OpenSimplex2S.cpp",
    "content": "#include \"OpenSimplex2S.hpp\"\n\nOpenSimplex2S::Grad2 OpenSimplex2S::GRADIENTS_2D[OpenSimplex2S::PSIZE] {};\nOpenSimplex2S::Grad3 OpenSimplex2S::GRADIENTS_3D[OpenSimplex2S::PSIZE] {};\nOpenSimplex2S::Grad4 OpenSimplex2S::GRADIENTS_4D[OpenSimplex2S::PSIZE] {};\n\nOpenSimplex2S::LatticePoint2D OpenSimplex2S::LOOKUP_2D[8 * 4] {};\nOpenSimplex2S::LatticePoint3D OpenSimplex2S::LOOKUP_3D[8] {};\nOpenSimplex2S::LatticePoint4D OpenSimplex2S::LOOKUP_4D[256][20] {};\nunsigned char OpenSimplex2S::LOOKUP_4D_SIZE[256] {};\n\nOpenSimplex2S::Initializer::Initializer()\n{\n  OpenSimplex2S::initLatticePoints();\n  OpenSimplex2S::initGradients();\n}\n\nOpenSimplex2S::Initializer OpenSimplex2S::initializer {};\n\nOpenSimplex2S::OpenSimplex2S(long seed)\n{\n  short source[PSIZE] {};\n  for (short i = 0; i < PSIZE; i++) {\n    source[i] = i;\n  }\n  for (int i = PSIZE - 1; i >= 0; i--) {\n    seed = seed * 6364136223846793005L + 1442695040888963407L;\n    int r = static_cast<int>((seed + 31) % (i + 1));\n    if (r < 0) {\n      r += (i + 1);\n    }\n    perm[i] = source[r];\n    permGrad2[i] = GRADIENTS_2D[perm[i]];\n    permGrad3[i] = GRADIENTS_3D[perm[i]];\n    permGrad4[i] = GRADIENTS_4D[perm[i]];\n    source[r] = source[i];\n  }\n}\n\n/**\n * 2D SuperSimplex noise, standard lattice orientation.\n */\ndouble OpenSimplex2S::noise2(double x, double y)\n{\n  // Get points for A2* lattice\n  double s = 0.366025403784439 * (x + y);\n  double xs = x + s;\n  double ys = y + s;\n\n  return noise2_Base(xs, ys);\n}\n\n/**\n * 2D SuperSimplex noise, with Y pointing down the main diagonal.\n * Might be better for a 2D sandbox style game, where Y is vertical.\n * Probably slightly less optimal for heightmaps or continent maps.\n */\ndouble OpenSimplex2S::noise2_XBeforeY(double x, double y)\n{\n  // Skew transform and rotation baked into one.\n  double xx = x * 0.7071067811865476;\n  double yy = y * 1.224744871380249;\n\n  return noise2_Base(yy + xx, yy - xx);\n}\n\n/**\n * 2D SuperSimplex noise base.\n * Lookup table implementation inspired by DigitalShadow.\n */\ndouble OpenSimplex2S::noise2_Base(double xs, double ys)\n{\n  double value = 0;\n\n  // Get base points and offsets\n  int xsb = fastFloor(xs);\n  int ysb = fastFloor(ys);\n  double xsi = xs - xsb;\n  double ysi = ys - ysb;\n\n  // Index to point list\n  int a = static_cast<int>(xsi + ysi);\n  int index = (a << 2) | static_cast<int>(xsi - ysi / 2 + 1 - a / 2.0) << 3\n            | static_cast<int>(ysi - xsi / 2 + 1 - a / 2.0) << 4;\n\n  double ssi = (xsi + ysi) * -0.211324865405187;\n  double xi = xsi + ssi;\n  double yi = ysi + ssi;\n\n  // Point contributions\n  for (int i = 0; i < 4; i++) {\n    LatticePoint2D c = LOOKUP_2D[index + i];\n\n    double dx = xi + c.dx;\n    double dy = yi + c.dy;\n    double attn = 2.0 / 3.0 - dx * dx - dy * dy;\n    if (attn <= 0) {\n      continue;\n    }\n\n    int pxm = (xsb + c.xsv) & PMASK;\n    int pym = (ysb + c.ysv) & PMASK;\n    Grad2 grad = permGrad2[perm[pxm] ^ pym];\n    double extrapolation = grad.dx * dx + grad.dy * dy;\n\n    attn *= attn;\n    value += attn * attn * extrapolation;\n  }\n\n  return value;\n}\n\n/**\n * 3D Re-oriented 8-point BCC noise, classic orientation\n * Proper substitute for what 3D SuperSimplex would be,\n * in light of Forbidden Formulae.\n * Use noise3_XYBeforeZ or noise3_XZBeforeY instead, wherever appropriate.\n */\ndouble OpenSimplex2S::noise3_Classic(double x, double y, double z)\n{\n  // Re-orient the cubic lattices via rotation, to produce the expected look on cardinal planar\n  // slices. If texturing objects that don't tend to have cardinal plane faces, you could even\n  // remove this. Orthonormal rotation. Not a skew transform.\n  double r = (2.0 / 3.0) * (x + y + z);\n  double xr = r - x;\n  double yr = r - y;\n  double zr = r - z;\n\n  // Evaluate both lattices to form a BCC lattice.\n  return noise3_BCC(xr, yr, zr);\n}\n\n/**\n * 3D Re-oriented 8-point BCC noise, with better visual isotropy in (X, Y).\n * Recommended for 3D terrain and time-varied animations.\n * The Z coordinate should always be the \"different\" coordinate in your use case.\n * If Y is vertical in world coordinates, call noise3_XYBeforeZ(x, z, Y) or use noise3_XZBeforeY.\n * If Z is vertical in world coordinates, call noise3_XYBeforeZ(x, y, Z).\n * For a time varied animation, call noise3_XYBeforeZ(x, y, T).\n */\ndouble OpenSimplex2S::noise3_XYBeforeZ(double x, double y, double z)\n{\n  // Re-orient the cubic lattices without skewing, to make X and Y triangular like 2D.\n  // Orthonormal rotation. Not a skew transform.\n  double xy = x + y;\n  double s2 = xy * -0.211324865405187;\n  double zz = z * 0.577350269189626;\n  double xr = x + s2 - zz;\n  double yr = y + s2 - zz;\n  double zr = xy * 0.577350269189626 + zz;\n\n  // Evaluate both lattices to form a BCC lattice.\n  return noise3_BCC(xr, yr, zr);\n}\n\n/**\n * 3D Re-oriented 8-point BCC noise, with better visual isotropy in (X, Z).\n * Recommended for 3D terrain and time-varied animations.\n * The Y coordinate should always be the \"different\" coordinate in your use case.\n * If Y is vertical in world coordinates, call noise3_XZBeforeY(x, Y, z).\n * If Z is vertical in world coordinates, call noise3_XZBeforeY(x, Z, y) or use noise3_XYBeforeZ.\n * For a time varied animation, call noise3_XZBeforeY(x, T, y) or use noise3_XYBeforeZ.\n */\ndouble OpenSimplex2S::noise3_XZBeforeY(double x, double y, double z)\n{\n  // Re-orient the cubic lattices without skewing, to make X and Z triangular like 2D.\n  // Orthonormal rotation. Not a skew transform.\n  double xz = x + z;\n  double s2 = xz * -0.211324865405187;\n  double yy = y * 0.577350269189626;\n  double xr = x + s2 - yy;\n  double zr = z + s2 - yy;\n  double yr = xz * 0.577350269189626 + yy;\n\n  // Evaluate both lattices to form a BCC lattice.\n  return noise3_BCC(xr, yr, zr);\n}\n\n/**\n * Generate overlapping cubic lattices for 3D Re-oriented BCC noise.\n * Lookup table implementation inspired by DigitalShadow.\n * It was actually faster to narrow down the points in the loop itself,\n * than to build up the index with enough info to isolate 8 points.\n */\ndouble OpenSimplex2S::noise3_BCC(double xr, double yr, double zr)\n{\n  // Get base and offsets inside cube of first lattice.\n  int xrb = fastFloor(xr);\n  int yrb = fastFloor(yr);\n  int zrb = fastFloor(zr);\n  double xri = xr - xrb;\n  double yri = yr - yrb;\n  double zri = zr - zrb;\n\n  // Identify which octant of the cube we're in. This determines which cell\n  // in the other cubic lattice we're in, and also narrows down one point on each.\n  int xht = static_cast<int>(xri + 0.5);\n  int yht = static_cast<int>(yri + 0.5);\n  int zht = static_cast<int>(zri + 0.5);\n  int index = (xht << 0) | (yht << 1) | (zht << 2);\n\n  // Point contributions\n  double value = 0;\n  LatticePoint3D* c = &LOOKUP_3D[index];\n  while (c != nullptr) {\n    double dxr = xri + c->dxr;\n    double dyr = yri + c->dyr;\n    double dzr = zri + c->dzr;\n    double attn = 0.75 - dxr * dxr - dyr * dyr - dzr * dzr;\n    if (attn < 0) {\n      c = c->nextOnFailure;\n    } else {\n      int pxm = (xrb + c->xrv) & PMASK;\n      int pym = (yrb + c->yrv) & PMASK;\n      int pzm = (zrb + c->zrv) & PMASK;\n      Grad3 grad = permGrad3[perm[perm[pxm] ^ pym] ^ pzm];\n      double extrapolation = grad.dx * dxr + grad.dy * dyr + grad.dz * dzr;\n\n      attn *= attn;\n      value += attn * attn * extrapolation;\n      c = c->nextOnSuccess;\n    }\n  }\n  return value;\n}\n\n/**\n * 4D SuperSimplex noise, classic lattice orientation.\n */\ndouble OpenSimplex2S::noise4_Classic(double x, double y, double z, double w)\n{\n  // Get points for A4 lattice\n  double s = 0.309016994374947 * (x + y + z + w);\n  double xs = x + s;\n  double ys = y + s;\n  double zs = z + s;\n  double ws = w + s;\n\n  return noise4_Base(xs, ys, zs, ws);\n}\n\n/**\n * 4D SuperSimplex noise, with XY and ZW forming orthogonal triangular-based planes.\n * Recommended for 3D terrain, where X and Y (or Z and W) are horizontal.\n * Recommended for noise(x, y, sin(time), cos(time)) trick.\n */\ndouble OpenSimplex2S::noise4_XYBeforeZW(double x, double y, double z, double w)\n{\n  double s2 = (x + y) * -0.28522513987434876941 + (z + w) * 0.83897065470611435718;\n  double t2 = (z + w) * 0.21939749883706435719 + (x + y) * -0.48214856493302476942;\n  double xs = x + s2;\n  double ys = y + s2;\n  double zs = z + t2;\n  double ws = w + t2;\n\n  return noise4_Base(xs, ys, zs, ws);\n}\n\n/**\n * 4D SuperSimplex noise, with XZ and YW forming orthogonal triangular-based planes.\n * Recommended for 3D terrain, where X and Z (or Y and W) are horizontal.\n */\ndouble OpenSimplex2S::noise4_XZBeforeYW(double x, double y, double z, double w)\n{\n  double s2 = (x + z) * -0.28522513987434876941 + (y + w) * 0.83897065470611435718;\n  double t2 = (y + w) * 0.21939749883706435719 + (x + z) * -0.48214856493302476942;\n  double xs = x + s2;\n  double ys = y + t2;\n  double zs = z + s2;\n  double ws = w + t2;\n\n  return noise4_Base(xs, ys, zs, ws);\n}\n\n/**\n * 4D SuperSimplex noise, with XYZ oriented like noise3_Classic,\n * and W for an extra degree of freedom.\n * Recommended for time-varied animations which texture a 3D object (W=time)\n */\ndouble OpenSimplex2S::noise4_XYZBeforeW(double x, double y, double z, double w)\n{\n  double xyz = x + y + z;\n  double ww = w * 1.118033988749894;\n  double s2 = xyz * -0.16666666666666666 + ww;\n  double xs = x + s2;\n  double ys = y + s2;\n  double zs = z + s2;\n  double ws = -0.5 * xyz + ww;\n\n  return noise4_Base(xs, ys, zs, ws);\n}\n\n/**\n * 4D SuperSimplex noise base.\n * Using ultra-simple 4x4x4x4 lookup partitioning.\n * This isn't as elegant or SIMD/GPU/etc. portable as other approaches,\n * but it does compete performance-wise with optimized OpenSimplex1.\n */\ndouble OpenSimplex2S::noise4_Base(double xs, double ys, double zs, double ws)\n{\n  double value = 0;\n\n  // Get base points and offsets\n  int xsb = fastFloor(xs);\n  int ysb = fastFloor(ys);\n  int zsb = fastFloor(zs);\n  int wsb = fastFloor(ws);\n  double xsi = xs - xsb;\n  double ysi = ys - ysb;\n  double zsi = zs - zsb;\n  double wsi = ws - wsb;\n\n  // Unskewed offsets\n  double ssi = (xsi + ysi + zsi + wsi) * -0.138196601125011;\n  double xi = xsi + ssi;\n  double yi = ysi + ssi;\n  double zi = zsi + ssi;\n  double wi = wsi + ssi;\n\n  int index = ((fastFloor(xs * 4) & 3) << 0) | ((fastFloor(ys * 4) & 3) << 2)\n            | ((fastFloor(zs * 4) & 3) << 4) | ((fastFloor(ws * 4) & 3) << 6);\n\n  // Point contributions\n  for (int i = 0; i < LOOKUP_4D_SIZE[index]; ++i) {\n    auto& c = LOOKUP_4D[index][i];\n    double dx = xi + c.dx;\n    double dy = yi + c.dy;\n    double dz = zi + c.dz;\n    double dw = wi + c.dw;\n    double attn = 0.8 - dx * dx - dy * dy - dz * dz - dw * dw;\n    if (attn > 0) {\n      attn *= attn;\n\n      int pxm = (xsb + c.xsv) & PMASK;\n      int pym = (ysb + c.ysv) & PMASK;\n      int pzm = (zsb + c.zsv) & PMASK;\n      int pwm = (wsb + c.wsv) & PMASK;\n      Grad4 grad = permGrad4[perm[perm[perm[pxm] ^ pym] ^ pzm] ^ pwm];\n      double extrapolation = grad.dx * dx + grad.dy * dy + grad.dz * dz + grad.dw * dw;\n\n      value += attn * attn * extrapolation;\n    }\n  }\n  return value;\n}\n\nint OpenSimplex2S::fastFloor(double x)\n{\n  int xi = static_cast<int>(x);\n  return x < xi ? xi - 1 : xi;\n}\n\nOpenSimplex2S::LatticePoint2D::LatticePoint2D(int a_xsv, int a_ysv)\n{\n  xsv = a_xsv;\n  ysv = a_ysv;\n  double ssv = (a_xsv + a_ysv) * -0.211324865405187;\n  dx = -a_xsv - ssv;\n  dy = -a_ysv - ssv;\n}\n\nOpenSimplex2S::LatticePoint2D::LatticePoint2D() = default;\n\nOpenSimplex2S::LatticePoint3D::LatticePoint3D(int a_xrv, int a_yrv, int a_zrv, int lattice)\n{\n  dxr = -a_xrv + lattice * 0.5;\n  dyr = -a_yrv + lattice * 0.5;\n  dzr = -a_zrv + lattice * 0.5;\n  xrv = a_xrv + lattice * 1024;\n  yrv = a_yrv + lattice * 1024;\n  zrv = a_zrv + lattice * 1024;\n}\n\nOpenSimplex2S::LatticePoint3D::LatticePoint3D() = default;\n\nOpenSimplex2S::LatticePoint4D::LatticePoint4D(int a_xsv, int a_ysv, int a_zsv, int a_wsv)\n{\n  xsv = a_xsv;\n  ysv = a_ysv;\n  zsv = a_zsv;\n  wsv = a_wsv;\n  double ssv = (a_xsv + a_ysv + a_zsv + a_wsv) * -0.138196601125011;\n  dx = -a_xsv - ssv;\n  dy = -a_ysv - ssv;\n  dz = -a_zsv - ssv;\n  dw = -a_wsv - ssv;\n}\n\nOpenSimplex2S::LatticePoint4D::LatticePoint4D() = default;\n\nvoid OpenSimplex2S::initLatticePoints()\n{\n  for (int i = 0; i < 8; i++) {\n    int i1, j1, i2, j2;\n    if ((i & 1) == 0) {\n      if ((i & 2) == 0) {\n        i1 = -1;\n        j1 = 0;\n      } else {\n        i1 = 1;\n        j1 = 0;\n      }\n      if ((i & 4) == 0) {\n        i2 = 0;\n        j2 = -1;\n      } else {\n        i2 = 0;\n        j2 = 1;\n      }\n    } else {\n      if ((i & 2) != 0) {\n        i1 = 2;\n        j1 = 1;\n      } else {\n        i1 = 0;\n        j1 = 1;\n      }\n      if ((i & 4) != 0) {\n        i2 = 1;\n        j2 = 2;\n      } else {\n        i2 = 1;\n        j2 = 0;\n      }\n    }\n    LOOKUP_2D[i * 4 + 0] = { 0, 0 };\n    LOOKUP_2D[i * 4 + 1] = { 1, 1 };\n    LOOKUP_2D[i * 4 + 2] = { i1, j1 };\n    LOOKUP_2D[i * 4 + 3] = { i2, j2 };\n  }\n\n  for (int i = 0; i < 8; i++) {\n    int i1, j1, k1, i2, j2, k2;\n    i1 = (i >> 0) & 1;\n    j1 = (i >> 1) & 1;\n    k1 = (i >> 2) & 1;\n    i2 = i1 ^ 1;\n    j2 = j1 ^ 1;\n    k2 = k1 ^ 1;\n\n    // The two points within this octant, one from each of the two cubic half-lattices.\n    auto* c0 = new LatticePoint3D(i1, j1, k1, 0);\n    auto* c1 = new LatticePoint3D(i1 + i2, j1 + j2, k1 + k2, 1);\n\n    // (1, 0, 0) vs (0, 1, 1) away from octant.\n    auto* c2 = new LatticePoint3D(i1 ^ 1, j1, k1, 0);\n    auto* c3 = new LatticePoint3D(i1, j1 ^ 1, k1 ^ 1, 0);\n\n    // (1, 0, 0) vs (0, 1, 1) away from octant, on second half-lattice.\n    auto* c4 = new LatticePoint3D(i1 + (i2 ^ 1), j1 + j2, k1 + k2, 1);\n    auto* c5 = new LatticePoint3D(i1 + i2, j1 + (j2 ^ 1), k1 + (k2 ^ 1), 1);\n\n    // (0, 1, 0) vs (1, 0, 1) away from octant.\n    auto* c6 = new LatticePoint3D(i1, j1 ^ 1, k1, 0);\n    auto* c7 = new LatticePoint3D(i1 ^ 1, j1, k1 ^ 1, 0);\n\n    // (0, 1, 0) vs (1, 0, 1) away from octant, on second half-lattice.\n    auto* c8 = new LatticePoint3D(i1 + i2, j1 + (j2 ^ 1), k1 + k2, 1);\n    auto* c9 = new LatticePoint3D(i1 + (i2 ^ 1), j1 + j2, k1 + (k2 ^ 1), 1);\n\n    // (0, 0, 1) vs (1, 1, 0) away from octant.\n    auto* cA = new LatticePoint3D(i1, j1, k1 ^ 1, 0);\n    auto* cB = new LatticePoint3D(i1 ^ 1, j1 ^ 1, k1, 0);\n\n    // (0, 0, 1) vs (1, 1, 0) away from octant, on second half-lattice.\n    auto* cC = new LatticePoint3D(i1 + i2, j1 + j2, k1 + (k2 ^ 1), 1);\n    auto* cD = new LatticePoint3D(i1 + (i2 ^ 1), j1 + (j2 ^ 1), k1 + k2, 1);\n\n    // First two points are guaranteed.\n    c0->nextOnFailure = c0->nextOnSuccess = c1;\n    c1->nextOnFailure = c1->nextOnSuccess = c2;\n\n    // If c2 is in range, then we know c3 and c4 are not.\n    c2->nextOnFailure = c3;\n    c2->nextOnSuccess = c5;\n    c3->nextOnFailure = c4;\n    c3->nextOnSuccess = c4;\n\n    // If c4 is in range, then we know c5 is not.\n    c4->nextOnFailure = c5;\n    c4->nextOnSuccess = c6;\n    c5->nextOnFailure = c5->nextOnSuccess = c6;\n\n    // If c6 is in range, then we know c7 and c8 are not.\n    c6->nextOnFailure = c7;\n    c6->nextOnSuccess = c9;\n    c7->nextOnFailure = c8;\n    c7->nextOnSuccess = c8;\n\n    // If c8 is in range, then we know c9 is not.\n    c8->nextOnFailure = c9;\n    c8->nextOnSuccess = cA;\n    c9->nextOnFailure = c9->nextOnSuccess = cA;\n\n    // If cA is in range, then we know cB and cC are not.\n    cA->nextOnFailure = cB;\n    cA->nextOnSuccess = cD;\n    cB->nextOnFailure = cC;\n    cB->nextOnSuccess = cC;\n\n    // If cC is in range, then we know cD is not.\n    cC->nextOnFailure = cD;\n    cC->nextOnSuccess = nullptr;\n    cD->nextOnFailure = cD->nextOnSuccess = nullptr;\n\n    LOOKUP_3D[i] = *c0;\n  }\n\n  unsigned char lookup4DPregenSize[256] {\n    // clang-format off\n    20, 15, 16, 17, 15, 16, 12, 15, 16, 12, 10, 14, 17, 15, 14, 17,\n    15, 16, 12, 15, 16, 14, 14, 13, 12, 14, 11, 12, 15, 13, 12, 14,\n    16, 12, 10, 14, 12, 14, 11, 12, 10, 11, 10, 13, 14, 12, 13, 15,\n    17, 15, 14, 17, 15, 13, 12, 14, 14, 12, 13, 15, 17, 14, 15, 17,\n    15, 16, 12, 15, 16, 14, 14, 13, 12, 14, 11, 12, 15, 13, 12, 14,\n    16, 14, 14, 13, 14, 16, 16, 10, 14, 16, 19, 11, 13, 10, 11, 10,\n    12, 14, 11, 12, 14, 16, 19, 11, 11, 19, 13, 14, 12, 11, 14, 13,\n    15, 13, 12, 14, 13, 10, 11, 10, 12, 11, 14, 13, 14, 10, 13, 13,\n    16, 12, 10, 14, 12, 14, 11, 12, 10, 11, 10, 13, 14, 12, 13, 15,\n    12, 14, 11, 12, 14, 16, 19, 11, 11, 19, 13, 14, 12, 11, 14, 13,\n    10, 11, 10, 13, 11, 19, 13, 14, 10, 13, 16, 14, 13, 14, 14, 16,\n    14, 12, 13, 15, 12, 11, 14, 13, 13, 14, 14, 16, 15, 13, 16, 15,\n    17, 15, 14, 17, 15, 13, 12, 14, 14, 12, 13, 15, 17, 14, 15, 17,\n    15, 13, 12, 14, 13, 10, 11, 10, 12, 11, 14, 13, 14, 10, 13, 13,\n    14, 12, 13, 15, 12, 11, 14, 13, 13, 14, 14, 16, 15, 13, 16, 15,\n    17, 14, 15, 17, 14, 10, 13, 13, 15, 13, 16, 15, 17, 13, 15, 20,\n    // clang-format on\n  };\n\n  unsigned char lookup4DPregen[256][20] {\n    // clang-format off\n    { 0x15, 0x45, 0x51, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n    { 0x15, 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x01, 0x05, 0x11, 0x15, 0x41, 0x45, 0x51, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0x00, 0x00, 0x00, 0x00 },\n    { 0x01, 0x15, 0x16, 0x45, 0x46, 0x51, 0x52, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB, 0x00, 0x00, 0x00 },\n    { 0x15, 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xAA, 0x00, 0x00, 0x00, 0x00 },\n    { 0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x05, 0x15, 0x16, 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x04, 0x05, 0x14, 0x15, 0x44, 0x45, 0x54, 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00 },\n    { 0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x9A, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x05, 0x15, 0x16, 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x5B, 0x6A, 0x9A, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x04, 0x15, 0x19, 0x45, 0x49, 0x54, 0x55, 0x58, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00 },\n    { 0x05, 0x15, 0x19, 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x05, 0x15, 0x19, 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x5E, 0x6A, 0x9A, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x05, 0x15, 0x1A, 0x45, 0x4A, 0x55, 0x56, 0x59, 0x5A, 0x5B, 0x5E, 0x6A, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF, 0x00, 0x00, 0x00 },\n    { 0x15, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x11, 0x15, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0x00, 0x00, 0x00, 0x00 },\n    { 0x11, 0x15, 0x51, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x96, 0xA6, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x11, 0x15, 0x16, 0x51, 0x52, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x96, 0xA6, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x14, 0x15, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x9A, 0xA6, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x16, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x6B, 0x96, 0x9A, 0xA6, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x14, 0x15, 0x54, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x99, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x9A, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x16, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x6B, 0x9A, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x14, 0x15, 0x19, 0x54, 0x55, 0x58, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x99, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x19, 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x6E, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x19, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x6E, 0x9A, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x1A, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x6B, 0x6E, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x10, 0x11, 0x14, 0x15, 0x50, 0x51, 0x54, 0x55, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00 },\n    { 0x11, 0x15, 0x51, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x11, 0x15, 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0xA6, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x11, 0x15, 0x16, 0x51, 0x52, 0x55, 0x56, 0x65, 0x66, 0x67, 0x6A, 0xA6, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x14, 0x15, 0x54, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA6, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x16, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x6B, 0xA6, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x14, 0x15, 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x16, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6B, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x14, 0x15, 0x19, 0x54, 0x55, 0x58, 0x59, 0x65, 0x69, 0x6A, 0x6D, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x19, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x6E, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x19, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6E, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x69, 0x6A, 0x6B, 0x6E, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x10, 0x15, 0x25, 0x51, 0x54, 0x55, 0x61, 0x64, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0x00, 0x00, 0x00 },\n    { 0x11, 0x15, 0x25, 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x11, 0x15, 0x25, 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x6A, 0x76, 0xA6, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x11, 0x15, 0x26, 0x51, 0x55, 0x56, 0x62, 0x65, 0x66, 0x67, 0x6A, 0x76, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB, 0x00, 0x00, 0x00 },\n    { 0x14, 0x15, 0x25, 0x54, 0x55, 0x59, 0x64, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA9, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x25, 0x55, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x25, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xA6, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x26, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x6B, 0x7A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x14, 0x15, 0x25, 0x54, 0x55, 0x59, 0x64, 0x65, 0x69, 0x6A, 0x79, 0xA9, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x25, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xA9, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x25, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6B, 0x7A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x14, 0x15, 0x29, 0x54, 0x55, 0x59, 0x65, 0x68, 0x69, 0x6A, 0x6D, 0x79, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE, 0x00, 0x00, 0x00 },\n    { 0x15, 0x29, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x6E, 0x7A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x55, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6E, 0x7A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6B, 0x6E, 0x7A, 0xAA, 0xAB, 0xAE, 0xBA, 0xBF, 0x00, 0x00, 0x00 },\n    { 0x45, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x41, 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xAA, 0x00, 0x00, 0x00, 0x00 },\n    { 0x41, 0x45, 0x51, 0x55, 0x56, 0x5A, 0x66, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x41, 0x45, 0x46, 0x51, 0x52, 0x55, 0x56, 0x5A, 0x66, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x44, 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x46, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x44, 0x45, 0x54, 0x55, 0x59, 0x5A, 0x69, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x96, 0x9A, 0x9B, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x44, 0x45, 0x49, 0x54, 0x55, 0x58, 0x59, 0x5A, 0x69, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x49, 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x99, 0x9A, 0x9E, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x4A, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x9A, 0x9B, 0x9E, 0xAA, 0xAB, 0xAE, 0xAF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x50, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x95, 0x96, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x59, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x52, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xA7, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x56, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0x00 },\n    { 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x58, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAD, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x50, 0x51, 0x54, 0x55, 0x65, 0x66, 0x69, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x52, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x96, 0xA6, 0xA7, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xBA, 0x00 },\n    { 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xBA, 0x00 },\n    { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x9A, 0xA6, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x58, 0x59, 0x65, 0x69, 0x6A, 0x99, 0xA9, 0xAA, 0xAD, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x69, 0x6A, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x50, 0x51, 0x54, 0x55, 0x61, 0x64, 0x65, 0x66, 0x69, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x61, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x6A, 0xA5, 0xA6, 0xAA, 0xB6, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x62, 0x65, 0x66, 0x6A, 0xA6, 0xA7, 0xAA, 0xAB, 0xB6, 0xBA, 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x64, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x65, 0x66, 0x6A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x64, 0x65, 0x69, 0x6A, 0xA5, 0xA9, 0xAA, 0xB9, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x65, 0x68, 0x69, 0x6A, 0xA9, 0xAA, 0xAD, 0xAE, 0xB9, 0xBA, 0xBE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x59, 0x65, 0x69, 0x6A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x15, 0x55, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xAA, 0xAB, 0xAE, 0xBA, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x40, 0x41, 0x44, 0x45, 0x50, 0x51, 0x54, 0x55, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00 },\n    { 0x41, 0x45, 0x51, 0x55, 0x56, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x41, 0x45, 0x51, 0x55, 0x56, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x41, 0x45, 0x46, 0x51, 0x52, 0x55, 0x56, 0x95, 0x96, 0x97, 0x9A, 0xA6, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x44, 0x45, 0x54, 0x55, 0x59, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x46, 0x55, 0x56, 0x5A, 0x95, 0x96, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x44, 0x45, 0x54, 0x55, 0x59, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9B, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x44, 0x45, 0x49, 0x54, 0x55, 0x58, 0x59, 0x95, 0x99, 0x9A, 0x9D, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x49, 0x55, 0x59, 0x5A, 0x95, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9E, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x96, 0x99, 0x9A, 0x9B, 0x9E, 0xAA, 0xAB, 0xAE, 0xAF, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x50, 0x51, 0x54, 0x55, 0x65, 0x95, 0x96, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x52, 0x55, 0x56, 0x66, 0x95, 0x96, 0x9A, 0xA6, 0xA7, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xEA, 0x00 },\n    { 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xEA, 0x00 },\n    { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x58, 0x59, 0x69, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAD, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x96, 0x99, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x50, 0x51, 0x54, 0x55, 0x65, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x52, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0x00 },\n    { 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x58, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x59, 0x5A, 0x66, 0x69, 0x6A, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xAF, 0x00, 0x00, 0x00, 0x00 },\n    { 0x50, 0x51, 0x54, 0x55, 0x61, 0x64, 0x65, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xB5, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x61, 0x65, 0x66, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0xB6, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x96, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB, 0xB6, 0xBA, 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x64, 0x65, 0x69, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x65, 0x66, 0x69, 0x6A, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x96, 0xA5, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x64, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xB9, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xBA, 0xBB, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x99, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE, 0xB9, 0xBA, 0xBE, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x99, 0xA5, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x40, 0x45, 0x51, 0x54, 0x55, 0x85, 0x91, 0x94, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA, 0x00, 0x00, 0x00 },\n    { 0x41, 0x45, 0x51, 0x55, 0x56, 0x85, 0x91, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xAA, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x41, 0x45, 0x51, 0x55, 0x56, 0x85, 0x91, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xD6, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x41, 0x45, 0x51, 0x55, 0x56, 0x86, 0x92, 0x95, 0x96, 0x97, 0x9A, 0xA6, 0xAA, 0xAB, 0xD6, 0xEA, 0xEB, 0x00, 0x00, 0x00 },\n    { 0x44, 0x45, 0x54, 0x55, 0x59, 0x85, 0x94, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xDA, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x56, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xDA, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x56, 0x86, 0x95, 0x96, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB, 0xDA, 0xEA, 0xEB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x44, 0x45, 0x54, 0x55, 0x59, 0x85, 0x94, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xD9, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x59, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xDA, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xAA, 0xDA, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x56, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB, 0xDA, 0xEA, 0xEB, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x44, 0x45, 0x54, 0x55, 0x59, 0x89, 0x95, 0x98, 0x99, 0x9A, 0x9D, 0xA9, 0xAA, 0xAE, 0xD9, 0xEA, 0xEE, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x59, 0x89, 0x95, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE, 0xDA, 0xEA, 0xEE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE, 0xDA, 0xEA, 0xEE, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9B, 0x9E, 0xAA, 0xAB, 0xAE, 0xDA, 0xEA, 0xEF, 0x00, 0x00, 0x00 },\n    { 0x50, 0x51, 0x54, 0x55, 0x65, 0x91, 0x94, 0x95, 0x96, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x91, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xE6, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x91, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xE6, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x92, 0x95, 0x96, 0x9A, 0xA6, 0xA7, 0xAA, 0xAB, 0xE6, 0xEA, 0xEB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x94, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xE9, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB, 0xEA, 0xEB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x94, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xE9, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x59, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x56, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xAB, 0xEA, 0xEB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x95, 0x98, 0x99, 0x9A, 0xA9, 0xAA, 0xAD, 0xAE, 0xE9, 0xEA, 0xEE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x59, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x45, 0x55, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xAA, 0xAB, 0xAE, 0xEA, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x50, 0x51, 0x54, 0x55, 0x65, 0x91, 0x94, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xE5, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x65, 0x91, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xE6, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x65, 0x66, 0x91, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0xE6, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x66, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB, 0xE6, 0xEA, 0xEB, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x65, 0x94, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xE9, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x65, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x66, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xAB, 0xEA, 0xEB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x65, 0x69, 0x94, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xE9, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x59, 0x65, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xEA, 0xEB, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x69, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE, 0xE9, 0xEA, 0xEE, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x69, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x50, 0x51, 0x54, 0x55, 0x65, 0x95, 0xA1, 0xA4, 0xA5, 0xA6, 0xA9, 0xAA, 0xB5, 0xBA, 0xE5, 0xEA, 0xFA, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x65, 0x95, 0xA1, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA, 0xE6, 0xEA, 0xFA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA, 0xE6, 0xEA, 0xFA, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB, 0xB6, 0xBA, 0xE6, 0xEA, 0xFB, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x65, 0x95, 0xA4, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA, 0xE9, 0xEA, 0xFA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x65, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x51, 0x55, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0xAB, 0xBA, 0xEA, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA, 0xE9, 0xEA, 0xFA, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xBA, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE, 0xB9, 0xBA, 0xE9, 0xEA, 0xFE, 0x00, 0x00, 0x00 },\n    { 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xAE, 0xBA, 0xEA, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xBA, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00 },\n    { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xBA, 0xEA },\n    // clang-format on\n  };\n\n  LatticePoint4D latticePoints[256];\n  for (int i = 0; i < 256; i++) {\n    int cx = ((i >> 0) & 3) - 1;\n    int cy = ((i >> 2) & 3) - 1;\n    int cz = ((i >> 4) & 3) - 1;\n    int cw = ((i >> 6) & 3) - 1;\n    latticePoints[i] = { cx, cy, cz, cw };\n  }\n  for (unsigned int i = 0; i < 256; i++) {\n    LOOKUP_4D_SIZE[i] = lookup4DPregenSize[i];\n    for (unsigned char j = 0; j < lookup4DPregenSize[i]; j++) {\n      LOOKUP_4D[i][j] = latticePoints[lookup4DPregen[i][j]];\n    }\n  }\n}\n\nvoid OpenSimplex2S::initGradients()\n{\n  static const int grad2_size = 24;\n  Grad2 grad2[grad2_size] {\n    { 0.130526192220052, 0.99144486137381 },    { 0.38268343236509, 0.923879532511287 },\n    { 0.608761429008721, 0.793353340291235 },   { 0.793353340291235, 0.608761429008721 },\n    { 0.923879532511287, 0.38268343236509 },    { 0.99144486137381, 0.130526192220051 },\n    { 0.99144486137381, -0.130526192220051 },   { 0.923879532511287, -0.38268343236509 },\n    { 0.793353340291235, -0.60876142900872 },   { 0.608761429008721, -0.793353340291235 },\n    { 0.38268343236509, -0.923879532511287 },   { 0.130526192220052, -0.99144486137381 },\n    { -0.130526192220052, -0.99144486137381 },  { -0.38268343236509, -0.923879532511287 },\n    { -0.608761429008721, -0.793353340291235 }, { -0.793353340291235, -0.608761429008721 },\n    { -0.923879532511287, -0.38268343236509 },  { -0.99144486137381, -0.130526192220052 },\n    { -0.99144486137381, 0.130526192220051 },   { -0.923879532511287, 0.38268343236509 },\n    { -0.793353340291235, 0.608761429008721 },  { -0.608761429008721, 0.793353340291235 },\n    { -0.38268343236509, 0.923879532511287 },   { -0.130526192220052, 0.99144486137381 },\n  };\n  for (int i = 0; i < grad2_size; i++) {\n    grad2[i].dx /= N2;\n    grad2[i].dy /= N2;\n  }\n  for (int i = 0; i < PSIZE; i++) {\n    GRADIENTS_2D[i] = grad2[i % grad2_size];\n  }\n\n  static const int grad3_size = 48;\n  Grad3 grad3[grad3_size] {\n    { -2.22474487139, -2.22474487139, -1.0 },\n    { -2.22474487139, -2.22474487139, 1.0 },\n    { -3.0862664687972017, -1.1721513422464978, 0.0 },\n    { -1.1721513422464978, -3.0862664687972017, 0.0 },\n    { -2.22474487139, -1.0, -2.22474487139 },\n    { -2.22474487139, 1.0, -2.22474487139 },\n    { -1.1721513422464978, 0.0, -3.0862664687972017 },\n    { -3.0862664687972017, 0.0, -1.1721513422464978 },\n    { -2.22474487139, -1.0, 2.22474487139 },\n    { -2.22474487139, 1.0, 2.22474487139 },\n    { -3.0862664687972017, 0.0, 1.1721513422464978 },\n    { -1.1721513422464978, 0.0, 3.0862664687972017 },\n    { -2.22474487139, 2.22474487139, -1.0 },\n    { -2.22474487139, 2.22474487139, 1.0 },\n    { -1.1721513422464978, 3.0862664687972017, 0.0 },\n    { -3.0862664687972017, 1.1721513422464978, 0.0 },\n    { -1.0, -2.22474487139, -2.22474487139 },\n    { 1.0, -2.22474487139, -2.22474487139 },\n    { 0.0, -3.0862664687972017, -1.1721513422464978 },\n    { 0.0, -1.1721513422464978, -3.0862664687972017 },\n    { -1.0, -2.22474487139, 2.22474487139 },\n    { 1.0, -2.22474487139, 2.22474487139 },\n    { 0.0, -1.1721513422464978, 3.0862664687972017 },\n    { 0.0, -3.0862664687972017, 1.1721513422464978 },\n    { -1.0, 2.22474487139, -2.22474487139 },\n    { 1.0, 2.22474487139, -2.22474487139 },\n    { 0.0, 1.1721513422464978, -3.0862664687972017 },\n    { 0.0, 3.0862664687972017, -1.1721513422464978 },\n    { -1.0, 2.22474487139, 2.22474487139 },\n    { 1.0, 2.22474487139, 2.22474487139 },\n    { 0.0, 3.0862664687972017, 1.1721513422464978 },\n    { 0.0, 1.1721513422464978, 3.0862664687972017 },\n    { 2.22474487139, -2.22474487139, -1.0 },\n    { 2.22474487139, -2.22474487139, 1.0 },\n    { 1.1721513422464978, -3.0862664687972017, 0.0 },\n    { 3.0862664687972017, -1.1721513422464978, 0.0 },\n    { 2.22474487139, -1.0, -2.22474487139 },\n    { 2.22474487139, 1.0, -2.22474487139 },\n    { 3.0862664687972017, 0.0, -1.1721513422464978 },\n    { 1.1721513422464978, 0.0, -3.0862664687972017 },\n    { 2.22474487139, -1.0, 2.22474487139 },\n    { 2.22474487139, 1.0, 2.22474487139 },\n    { 1.1721513422464978, 0.0, 3.0862664687972017 },\n    { 3.0862664687972017, 0.0, 1.1721513422464978 },\n    { 2.22474487139, 2.22474487139, -1.0 },\n    { 2.22474487139, 2.22474487139, 1.0 },\n    { 3.0862664687972017, 1.1721513422464978, 0.0 },\n    { 1.1721513422464978, 3.0862664687972017, 0.0 },\n  };\n  for (int i = 0; i < grad3_size; i++) {\n    grad3[i].dx /= N3;\n    grad3[i].dy /= N3;\n    grad3[i].dz /= N3;\n  }\n  for (int i = 0; i < PSIZE; i++) {\n    GRADIENTS_3D[i] = grad3[i % grad3_size];\n  }\n\n  static const int grad4_size = 160;\n  Grad4 grad4[grad4_size] {\n    { -0.753341017856078, -0.37968289875261624, -0.37968289875261624, -0.37968289875261624 },\n    { -0.7821684431180708, -0.4321472685365301, -0.4321472685365301, 0.12128480194602098 },\n    { -0.7821684431180708, -0.4321472685365301, 0.12128480194602098, -0.4321472685365301 },\n    { -0.7821684431180708, 0.12128480194602098, -0.4321472685365301, -0.4321472685365301 },\n    { -0.8586508742123365, -0.508629699630796, 0.044802370851755174, 0.044802370851755174 },\n    { -0.8586508742123365, 0.044802370851755174, -0.508629699630796, 0.044802370851755174 },\n    { -0.8586508742123365, 0.044802370851755174, 0.044802370851755174, -0.508629699630796 },\n    { -0.9982828964265062, -0.03381941603233842, -0.03381941603233842, -0.03381941603233842 },\n    { -0.37968289875261624, -0.753341017856078, -0.37968289875261624, -0.37968289875261624 },\n    { -0.4321472685365301, -0.7821684431180708, -0.4321472685365301, 0.12128480194602098 },\n    { -0.4321472685365301, -0.7821684431180708, 0.12128480194602098, -0.4321472685365301 },\n    { 0.12128480194602098, -0.7821684431180708, -0.4321472685365301, -0.4321472685365301 },\n    { -0.508629699630796, -0.8586508742123365, 0.044802370851755174, 0.044802370851755174 },\n    { 0.044802370851755174, -0.8586508742123365, -0.508629699630796, 0.044802370851755174 },\n    { 0.044802370851755174, -0.8586508742123365, 0.044802370851755174, -0.508629699630796 },\n    { -0.03381941603233842, -0.9982828964265062, -0.03381941603233842, -0.03381941603233842 },\n    { -0.37968289875261624, -0.37968289875261624, -0.753341017856078, -0.37968289875261624 },\n    { -0.4321472685365301, -0.4321472685365301, -0.7821684431180708, 0.12128480194602098 },\n    { -0.4321472685365301, 0.12128480194602098, -0.7821684431180708, -0.4321472685365301 },\n    { 0.12128480194602098, -0.4321472685365301, -0.7821684431180708, -0.4321472685365301 },\n    { -0.508629699630796, 0.044802370851755174, -0.8586508742123365, 0.044802370851755174 },\n    { 0.044802370851755174, -0.508629699630796, -0.8586508742123365, 0.044802370851755174 },\n    { 0.044802370851755174, 0.044802370851755174, -0.8586508742123365, -0.508629699630796 },\n    { -0.03381941603233842, -0.03381941603233842, -0.9982828964265062, -0.03381941603233842 },\n    { -0.37968289875261624, -0.37968289875261624, -0.37968289875261624, -0.753341017856078 },\n    { -0.4321472685365301, -0.4321472685365301, 0.12128480194602098, -0.7821684431180708 },\n    { -0.4321472685365301, 0.12128480194602098, -0.4321472685365301, -0.7821684431180708 },\n    { 0.12128480194602098, -0.4321472685365301, -0.4321472685365301, -0.7821684431180708 },\n    { -0.508629699630796, 0.044802370851755174, 0.044802370851755174, -0.8586508742123365 },\n    { 0.044802370851755174, -0.508629699630796, 0.044802370851755174, -0.8586508742123365 },\n    { 0.044802370851755174, 0.044802370851755174, -0.508629699630796, -0.8586508742123365 },\n    { -0.03381941603233842, -0.03381941603233842, -0.03381941603233842, -0.9982828964265062 },\n    { -0.6740059517812944, -0.3239847771997537, -0.3239847771997537, 0.5794684678643381 },\n    { -0.7504883828755602, -0.4004672082940195, 0.15296486218853164, 0.5029860367700724 },\n    { -0.7504883828755602, 0.15296486218853164, -0.4004672082940195, 0.5029860367700724 },\n    { -0.8828161875373585, 0.08164729285680945, 0.08164729285680945, 0.4553054119602712 },\n    { -0.4553054119602712, -0.08164729285680945, -0.08164729285680945, 0.8828161875373585 },\n    { -0.5029860367700724, -0.15296486218853164, 0.4004672082940195, 0.7504883828755602 },\n    { -0.5029860367700724, 0.4004672082940195, -0.15296486218853164, 0.7504883828755602 },\n    { -0.5794684678643381, 0.3239847771997537, 0.3239847771997537, 0.6740059517812944 },\n    { -0.3239847771997537, -0.6740059517812944, -0.3239847771997537, 0.5794684678643381 },\n    { -0.4004672082940195, -0.7504883828755602, 0.15296486218853164, 0.5029860367700724 },\n    { 0.15296486218853164, -0.7504883828755602, -0.4004672082940195, 0.5029860367700724 },\n    { 0.08164729285680945, -0.8828161875373585, 0.08164729285680945, 0.4553054119602712 },\n    { -0.08164729285680945, -0.4553054119602712, -0.08164729285680945, 0.8828161875373585 },\n    { -0.15296486218853164, -0.5029860367700724, 0.4004672082940195, 0.7504883828755602 },\n    { 0.4004672082940195, -0.5029860367700724, -0.15296486218853164, 0.7504883828755602 },\n    { 0.3239847771997537, -0.5794684678643381, 0.3239847771997537, 0.6740059517812944 },\n    { -0.3239847771997537, -0.3239847771997537, -0.6740059517812944, 0.5794684678643381 },\n    { -0.4004672082940195, 0.15296486218853164, -0.7504883828755602, 0.5029860367700724 },\n    { 0.15296486218853164, -0.4004672082940195, -0.7504883828755602, 0.5029860367700724 },\n    { 0.08164729285680945, 0.08164729285680945, -0.8828161875373585, 0.4553054119602712 },\n    { -0.08164729285680945, -0.08164729285680945, -0.4553054119602712, 0.8828161875373585 },\n    { -0.15296486218853164, 0.4004672082940195, -0.5029860367700724, 0.7504883828755602 },\n    { 0.4004672082940195, -0.15296486218853164, -0.5029860367700724, 0.7504883828755602 },\n    { 0.3239847771997537, 0.3239847771997537, -0.5794684678643381, 0.6740059517812944 },\n    { -0.6740059517812944, -0.3239847771997537, 0.5794684678643381, -0.3239847771997537 },\n    { -0.7504883828755602, -0.4004672082940195, 0.5029860367700724, 0.15296486218853164 },\n    { -0.7504883828755602, 0.15296486218853164, 0.5029860367700724, -0.4004672082940195 },\n    { -0.8828161875373585, 0.08164729285680945, 0.4553054119602712, 0.08164729285680945 },\n    { -0.4553054119602712, -0.08164729285680945, 0.8828161875373585, -0.08164729285680945 },\n    { -0.5029860367700724, -0.15296486218853164, 0.7504883828755602, 0.4004672082940195 },\n    { -0.5029860367700724, 0.4004672082940195, 0.7504883828755602, -0.15296486218853164 },\n    { -0.5794684678643381, 0.3239847771997537, 0.6740059517812944, 0.3239847771997537 },\n    { -0.3239847771997537, -0.6740059517812944, 0.5794684678643381, -0.3239847771997537 },\n    { -0.4004672082940195, -0.7504883828755602, 0.5029860367700724, 0.15296486218853164 },\n    { 0.15296486218853164, -0.7504883828755602, 0.5029860367700724, -0.4004672082940195 },\n    { 0.08164729285680945, -0.8828161875373585, 0.4553054119602712, 0.08164729285680945 },\n    { -0.08164729285680945, -0.4553054119602712, 0.8828161875373585, -0.08164729285680945 },\n    { -0.15296486218853164, -0.5029860367700724, 0.7504883828755602, 0.4004672082940195 },\n    { 0.4004672082940195, -0.5029860367700724, 0.7504883828755602, -0.15296486218853164 },\n    { 0.3239847771997537, -0.5794684678643381, 0.6740059517812944, 0.3239847771997537 },\n    { -0.3239847771997537, -0.3239847771997537, 0.5794684678643381, -0.6740059517812944 },\n    { -0.4004672082940195, 0.15296486218853164, 0.5029860367700724, -0.7504883828755602 },\n    { 0.15296486218853164, -0.4004672082940195, 0.5029860367700724, -0.7504883828755602 },\n    { 0.08164729285680945, 0.08164729285680945, 0.4553054119602712, -0.8828161875373585 },\n    { -0.08164729285680945, -0.08164729285680945, 0.8828161875373585, -0.4553054119602712 },\n    { -0.15296486218853164, 0.4004672082940195, 0.7504883828755602, -0.5029860367700724 },\n    { 0.4004672082940195, -0.15296486218853164, 0.7504883828755602, -0.5029860367700724 },\n    { 0.3239847771997537, 0.3239847771997537, 0.6740059517812944, -0.5794684678643381 },\n    { -0.6740059517812944, 0.5794684678643381, -0.3239847771997537, -0.3239847771997537 },\n    { -0.7504883828755602, 0.5029860367700724, -0.4004672082940195, 0.15296486218853164 },\n    { -0.7504883828755602, 0.5029860367700724, 0.15296486218853164, -0.4004672082940195 },\n    { -0.8828161875373585, 0.4553054119602712, 0.08164729285680945, 0.08164729285680945 },\n    { -0.4553054119602712, 0.8828161875373585, -0.08164729285680945, -0.08164729285680945 },\n    { -0.5029860367700724, 0.7504883828755602, -0.15296486218853164, 0.4004672082940195 },\n    { -0.5029860367700724, 0.7504883828755602, 0.4004672082940195, -0.15296486218853164 },\n    { -0.5794684678643381, 0.6740059517812944, 0.3239847771997537, 0.3239847771997537 },\n    { -0.3239847771997537, 0.5794684678643381, -0.6740059517812944, -0.3239847771997537 },\n    { -0.4004672082940195, 0.5029860367700724, -0.7504883828755602, 0.15296486218853164 },\n    { 0.15296486218853164, 0.5029860367700724, -0.7504883828755602, -0.4004672082940195 },\n    { 0.08164729285680945, 0.4553054119602712, -0.8828161875373585, 0.08164729285680945 },\n    { -0.08164729285680945, 0.8828161875373585, -0.4553054119602712, -0.08164729285680945 },\n    { -0.15296486218853164, 0.7504883828755602, -0.5029860367700724, 0.4004672082940195 },\n    { 0.4004672082940195, 0.7504883828755602, -0.5029860367700724, -0.15296486218853164 },\n    { 0.3239847771997537, 0.6740059517812944, -0.5794684678643381, 0.3239847771997537 },\n    { -0.3239847771997537, 0.5794684678643381, -0.3239847771997537, -0.6740059517812944 },\n    { -0.4004672082940195, 0.5029860367700724, 0.15296486218853164, -0.7504883828755602 },\n    { 0.15296486218853164, 0.5029860367700724, -0.4004672082940195, -0.7504883828755602 },\n    { 0.08164729285680945, 0.4553054119602712, 0.08164729285680945, -0.8828161875373585 },\n    { -0.08164729285680945, 0.8828161875373585, -0.08164729285680945, -0.4553054119602712 },\n    { -0.15296486218853164, 0.7504883828755602, 0.4004672082940195, -0.5029860367700724 },\n    { 0.4004672082940195, 0.7504883828755602, -0.15296486218853164, -0.5029860367700724 },\n    { 0.3239847771997537, 0.6740059517812944, 0.3239847771997537, -0.5794684678643381 },\n    { 0.5794684678643381, -0.6740059517812944, -0.3239847771997537, -0.3239847771997537 },\n    { 0.5029860367700724, -0.7504883828755602, -0.4004672082940195, 0.15296486218853164 },\n    { 0.5029860367700724, -0.7504883828755602, 0.15296486218853164, -0.4004672082940195 },\n    { 0.4553054119602712, -0.8828161875373585, 0.08164729285680945, 0.08164729285680945 },\n    { 0.8828161875373585, -0.4553054119602712, -0.08164729285680945, -0.08164729285680945 },\n    { 0.7504883828755602, -0.5029860367700724, -0.15296486218853164, 0.4004672082940195 },\n    { 0.7504883828755602, -0.5029860367700724, 0.4004672082940195, -0.15296486218853164 },\n    { 0.6740059517812944, -0.5794684678643381, 0.3239847771997537, 0.3239847771997537 },\n    { 0.5794684678643381, -0.3239847771997537, -0.6740059517812944, -0.3239847771997537 },\n    { 0.5029860367700724, -0.4004672082940195, -0.7504883828755602, 0.15296486218853164 },\n    { 0.5029860367700724, 0.15296486218853164, -0.7504883828755602, -0.4004672082940195 },\n    { 0.4553054119602712, 0.08164729285680945, -0.8828161875373585, 0.08164729285680945 },\n    { 0.8828161875373585, -0.08164729285680945, -0.4553054119602712, -0.08164729285680945 },\n    { 0.7504883828755602, -0.15296486218853164, -0.5029860367700724, 0.4004672082940195 },\n    { 0.7504883828755602, 0.4004672082940195, -0.5029860367700724, -0.15296486218853164 },\n    { 0.6740059517812944, 0.3239847771997537, -0.5794684678643381, 0.3239847771997537 },\n    { 0.5794684678643381, -0.3239847771997537, -0.3239847771997537, -0.6740059517812944 },\n    { 0.5029860367700724, -0.4004672082940195, 0.15296486218853164, -0.7504883828755602 },\n    { 0.5029860367700724, 0.15296486218853164, -0.4004672082940195, -0.7504883828755602 },\n    { 0.4553054119602712, 0.08164729285680945, 0.08164729285680945, -0.8828161875373585 },\n    { 0.8828161875373585, -0.08164729285680945, -0.08164729285680945, -0.4553054119602712 },\n    { 0.7504883828755602, -0.15296486218853164, 0.4004672082940195, -0.5029860367700724 },\n    { 0.7504883828755602, 0.4004672082940195, -0.15296486218853164, -0.5029860367700724 },\n    { 0.6740059517812944, 0.3239847771997537, 0.3239847771997537, -0.5794684678643381 },\n    { 0.03381941603233842, 0.03381941603233842, 0.03381941603233842, 0.9982828964265062 },\n    { -0.044802370851755174, -0.044802370851755174, 0.508629699630796, 0.8586508742123365 },\n    { -0.044802370851755174, 0.508629699630796, -0.044802370851755174, 0.8586508742123365 },\n    { -0.12128480194602098, 0.4321472685365301, 0.4321472685365301, 0.7821684431180708 },\n    { 0.508629699630796, -0.044802370851755174, -0.044802370851755174, 0.8586508742123365 },\n    { 0.4321472685365301, -0.12128480194602098, 0.4321472685365301, 0.7821684431180708 },\n    { 0.4321472685365301, 0.4321472685365301, -0.12128480194602098, 0.7821684431180708 },\n    { 0.37968289875261624, 0.37968289875261624, 0.37968289875261624, 0.753341017856078 },\n    { 0.03381941603233842, 0.03381941603233842, 0.9982828964265062, 0.03381941603233842 },\n    { -0.044802370851755174, 0.044802370851755174, 0.8586508742123365, 0.508629699630796 },\n    { -0.044802370851755174, 0.508629699630796, 0.8586508742123365, -0.044802370851755174 },\n    { -0.12128480194602098, 0.4321472685365301, 0.7821684431180708, 0.4321472685365301 },\n    { 0.508629699630796, -0.044802370851755174, 0.8586508742123365, -0.044802370851755174 },\n    { 0.4321472685365301, -0.12128480194602098, 0.7821684431180708, 0.4321472685365301 },\n    { 0.4321472685365301, 0.4321472685365301, 0.7821684431180708, -0.12128480194602098 },\n    { 0.37968289875261624, 0.37968289875261624, 0.753341017856078, 0.37968289875261624 },\n    { 0.03381941603233842, 0.9982828964265062, 0.03381941603233842, 0.03381941603233842 },\n    { -0.044802370851755174, 0.8586508742123365, -0.044802370851755174, 0.508629699630796 },\n    { -0.044802370851755174, 0.8586508742123365, 0.508629699630796, -0.044802370851755174 },\n    { -0.12128480194602098, 0.7821684431180708, 0.4321472685365301, 0.4321472685365301 },\n    { 0.508629699630796, 0.8586508742123365, -0.044802370851755174, -0.044802370851755174 },\n    { 0.4321472685365301, 0.7821684431180708, -0.12128480194602098, 0.4321472685365301 },\n    { 0.4321472685365301, 0.7821684431180708, 0.4321472685365301, -0.12128480194602098 },\n    { 0.37968289875261624, 0.753341017856078, 0.37968289875261624, 0.37968289875261624 },\n    { 0.9982828964265062, 0.03381941603233842, 0.03381941603233842, 0.03381941603233842 },\n    { 0.8586508742123365, -0.044802370851755174, -0.044802370851755174, 0.508629699630796 },\n    { 0.8586508742123365, -0.044802370851755174, 0.508629699630796, -0.044802370851755174 },\n    { 0.7821684431180708, -0.12128480194602098, 0.4321472685365301, 0.4321472685365301 },\n    { 0.8586508742123365, 0.508629699630796, -0.044802370851755174, -0.044802370851755174 },\n    { 0.7821684431180708, 0.4321472685365301, -0.12128480194602098, 0.4321472685365301 },\n    { 0.7821684431180708, 0.4321472685365301, 0.4321472685365301, -0.12128480194602098 },\n    { 0.753341017856078, 0.37968289875261624, 0.37968289875261624, 0.37968289875261624 },\n  };\n  for (int i = 0; i < grad4_size; i++) {\n    grad4[i].dx /= N4;\n    grad4[i].dy /= N4;\n    grad4[i].dz /= N4;\n    grad4[i].dw /= N4;\n  }\n  for (int i = 0; i < PSIZE; i++) {\n    GRADIENTS_4D[i] = grad4[i % grad4_size];\n  }\n}\n"
  },
  {
    "path": "_old/cpp/OpenSimplex2S.hpp",
    "content": "/**\n * Ported from https://github.com/KdotJPG/OpenSimplex2/blob/master/java/OpenSimplex2S.java\n * Probably not best implementation of static initialization.\n * Also changed some code to use fixed c-style arrays, to avoid using of std library.\n */\n\n/**\n * K.jpg's OpenSimplex 2, smooth variant (\"SuperSimplex\")\n *\n * - 2D is standard simplex, modified to support larger kernels.\n *   Implemented using a lookup table.\n * - 3D is \"Re-oriented 8-point BCC noise\" which constructs a\n *   congruent BCC lattice in a much different way than usual.\n * - 4D uses a naïve pregenerated lookup table, and averages out\n *   to the expected performance.\n *\n * Multiple versions of each function are provided. See the\n * documentation above each, for more info.\n */\nclass OpenSimplex2S\n{\n  struct Grad2\n  {\n    double dx {};\n    double dy {};\n  };\n\n  struct Grad3\n  {\n    double dx {};\n    double dy {};\n    double dz {};\n  };\n\n  struct Grad4\n  {\n    double dx {};\n    double dy {};\n    double dz {};\n    double dw {};\n  };\n\n  struct LatticePoint2D\n  {\n    int xsv {};\n    int ysv {};\n    double dx {};\n    double dy {};\n\n    LatticePoint2D();\n    LatticePoint2D(int xsv, int ysv);\n  };\n\n  struct LatticePoint3D\n  {\n    double dxr {};\n    double dyr {};\n    double dzr {};\n    int xrv {};\n    int yrv {};\n    int zrv {};\n    LatticePoint3D* nextOnFailure {};\n    LatticePoint3D* nextOnSuccess {};\n    LatticePoint3D();\n    LatticePoint3D(int xrv, int yrv, int zrv, int lattice);\n  };\n\n  struct LatticePoint4D\n  {\n    int xsv {};\n    int ysv {};\n    int zsv {};\n    int wsv {};\n    double dx {};\n    double dy {};\n    double dz {};\n    double dw {};\n\n    LatticePoint4D();\n    LatticePoint4D(int xsv, int ysv, int zsv, int wsv);\n  };\n\n  static const int PSIZE = 2048;\n  static const int PMASK = 2047;\n\n  constexpr static const double N2 = 0.05481866495625118;\n  constexpr static const double N3 = 0.2781926117527186;\n  constexpr static const double N4 = 0.11127401889945551;\n\n  static Grad2 GRADIENTS_2D[PSIZE];\n  static Grad3 GRADIENTS_3D[PSIZE];\n  static Grad4 GRADIENTS_4D[PSIZE];\n\n  static LatticePoint2D LOOKUP_2D[8 * 4];\n  static LatticePoint3D LOOKUP_3D[8];\n  static LatticePoint4D LOOKUP_4D[256][20];\n  static unsigned char LOOKUP_4D_SIZE[256];\n\n  short perm[PSIZE];\n  Grad2 permGrad2[PSIZE];\n  Grad3 permGrad3[PSIZE];\n  Grad4 permGrad4[PSIZE];\n\n  /**\n   * 2D SuperSimplex noise base.\n   * Lookup table implementation inspired by DigitalShadow.\n   */\n  double noise2_Base(double xs, double ys);\n\n  /**\n   * Generate overlapping cubic lattices for 3D Re-oriented BCC noise.\n   * Lookup table implementation inspired by DigitalShadow.\n   * It was actually faster to narrow down the points in the loop itself,\n   * than to build up the index with enough info to isolate 8 points.\n   */\n  double noise3_BCC(double xr, double yr, double zr);\n\n  /**\n   * 4D SuperSimplex noise base.\n   * Using ultra-simple 4x4x4x4 lookup partitioning.\n   * This isn't as elegant or SIMD/GPU/etc. portable as other approaches,\n   * but it does compete performance-wise with optimized OpenSimplex1.\n   */\n  double noise4_Base(double xs, double ys, double zs, double ws);\n\n  static int fastFloor(double x);\n\n  static void initLatticePoints();\n  static void initGradients();\n\n  struct Initializer\n  {\n    Initializer();\n  };\n  static Initializer initializer;\n\npublic:\n  explicit OpenSimplex2S(long seed = 0);\n\n  /**\n   * 2D SuperSimplex noise, standard lattice orientation.\n   */\n  double noise2(double x, double y);\n\n  /**\n   * 2D SuperSimplex noise, with Y pointing down the main diagonal.\n   * Might be better for a 2D sandbox style game, where Y is vertical.\n   * Probably slightly less optimal for heightmaps or continent maps.\n   */\n  double noise2_XBeforeY(double x, double y);\n\n  /**\n   * 3D Re-oriented 8-point BCC noise, classic orientation\n   * Proper substitute for what 3D SuperSimplex would be,\n   * in light of Forbidden Formulae.\n   * Use noise3_XYBeforeZ or noise3_XZBeforeY instead, wherever appropriate.\n   */\n  double noise3_Classic(double x, double y, double z);\n\n  /**\n   * 3D Re-oriented 8-point BCC noise, with better visual isotropy in (X, Y).\n   * Recommended for 3D terrain and time-varied animations.\n   * The Z coordinate should always be the \"different\" coordinate in your use case.\n   * If Y is vertical in world coordinates, call noise3_XYBeforeZ(x, z, Y) or use noise3_XZBeforeY.\n   * If Z is vertical in world coordinates, call noise3_XYBeforeZ(x, y, Z).\n   * For a time varied animation, call noise3_XYBeforeZ(x, y, T).\n   */\n  double noise3_XYBeforeZ(double x, double y, double z);\n\n  /**\n   * 3D Re-oriented 8-point BCC noise, with better visual isotropy in (X, Z).\n   * Recommended for 3D terrain and time-varied animations.\n   * The Y coordinate should always be the \"different\" coordinate in your use case.\n   * If Y is vertical in world coordinates, call noise3_XZBeforeY(x, Y, z).\n   * If Z is vertical in world coordinates, call noise3_XZBeforeY(x, Z, y) or use noise3_XYBeforeZ.\n   * For a time varied animation, call noise3_XZBeforeY(x, T, y) or use noise3_XYBeforeZ.\n   */\n  double noise3_XZBeforeY(double x, double y, double z);\n\n  /**\n   * 4D SuperSimplex noise, classic lattice orientation.\n   */\n  double noise4_Classic(double x, double y, double z, double w);\n\n  /**\n   * 4D SuperSimplex noise, with XY and ZW forming orthogonal triangular-based planes.\n   * Recommended for 3D terrain, where X and Y (or Z and W) are horizontal.\n   * Recommended for noise(x, y, sin(time), cos(time)) trick.\n   */\n  double noise4_XYBeforeZW(double x, double y, double z, double w);\n\n  /**\n   * 4D SuperSimplex noise, with XZ and YW forming orthogonal triangular-based planes.\n   * Recommended for 3D terrain, where X and Z (or Y and W) are horizontal.\n   */\n  double noise4_XZBeforeYW(double x, double y, double z, double w);\n\n  /**\n   * 4D SuperSimplex noise, with XYZ oriented like noise3_Classic,\n   * and W for an extra degree of freedom.\n   * Recommended for time-varied animations which texture a 3D object (W=time)\n   */\n  double noise4_XYZBeforeW(double x, double y, double z, double w);\n};\n"
  },
  {
    "path": "_old/cpp/UNLICENSE",
    "content": "This is free and unencumbered software released into the public domain.\n\nAnyone is free to copy, modify, publish, use, compile, sell, or\ndistribute this software, either in source code form or as a compiled\nbinary, for any purpose, commercial or non-commercial, and by any\nmeans.\n\nIn jurisdictions that recognize copyright laws, the author or authors\nof this software dedicate any and all copyright interest in the\nsoftware to the public domain. We make this dedication for the benefit\nof the public at large and to the detriment of our heirs and\nsuccessors. We intend this dedication to be an overt act of\nrelinquishment in perpetuity of all present and future rights to this\nsoftware under copyright law.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR\nOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\nFor more information, please refer to <https://unlicense.org>\n"
  },
  {
    "path": "_old/csharp/OpenSimplex2F.cs",
    "content": "﻿/**\n * K.jpg's OpenSimplex 2, faster variant\n *\n * - 2D is standard simplex implemented using a lookup table.\n * - 3D is \"Re-oriented 4-point BCC noise\" which constructs a\n *   congruent BCC lattice in a much different way than usual.\n * - 4D constructs the lattice as a union of five copies of its\n *   reciprocal. It successively finds the closest point on each.\n *\n * Multiple versions of each function are provided. See the\n * documentation above each, for more info.\n */\n\nusing System;\nusing System.Runtime.CompilerServices;\n\nnamespace Noise\n{\n    public class OpenSimplex2F\n    {\n        private const int PSIZE = 2048;\n        private const int PMASK = 2047;\n\n        private short[] perm;\n        private Grad2[] permGrad2;\n        private Grad3[] permGrad3;\n        private Grad4[] permGrad4;\n\n        public OpenSimplex2F(long seed)\n        {\n            perm = new short[PSIZE];\n            permGrad2 = new Grad2[PSIZE];\n            permGrad3 = new Grad3[PSIZE];\n            permGrad4 = new Grad4[PSIZE];\n            short[] source = new short[PSIZE];\n            for (short i = 0; i < PSIZE; i++)\n                source[i] = i;\n            for (int i = PSIZE - 1; i >= 0; i--)\n            {\n                seed = seed * 6364136223846793005L + 1442695040888963407L;\n                int r = (int)((seed + 31) % (i + 1));\n                if (r < 0)\n                    r += (i + 1);\n                perm[i] = source[r];\n                permGrad2[i] = GRADIENTS_2D[perm[i]];\n                permGrad3[i] = GRADIENTS_3D[perm[i]];\n                permGrad4[i] = GRADIENTS_4D[perm[i]];\n                source[r] = source[i];\n            }\n        }\n\n        /*\n         * Noise Evaluators\n         */\n\n        /**\n         * 2D Simplex noise, standard lattice orientation.\n         */\n        public double Noise2(double x, double y)\n        {\n\n            // Get points for A2* lattice\n            double s = 0.366025403784439 * (x + y);\n            double xs = x + s, ys = y + s;\n\n            return noise2_Base(xs, ys);\n        }\n\n        /**\n         * 2D Simplex noise, with Y pointing down the main diagonal.\n         * Might be better for a 2D sandbox style game, where Y is vertical.\n         * Probably slightly less optimal for heightmaps or continent maps.\n         */\n        public double Noise2_XBeforeY(double x, double y)\n        {\n\n            // Skew transform and rotation baked into one.\n            double xx = x * 0.7071067811865476;\n            double yy = y * 1.224744871380249;\n\n            return noise2_Base(yy + xx, yy - xx);\n        }\n\n        /**\n         * 2D Simplex noise base.\n         * Lookup table implementation inspired by DigitalShadow.\n         */\n        private double noise2_Base(double xs, double ys)\n        {\n            double value = 0;\n\n            // Get base points and offsets\n            int xsb = fastFloor(xs), ysb = fastFloor(ys);\n            double xsi = xs - xsb, ysi = ys - ysb;\n\n            // Index to point list\n            int index = (int)((ysi - xsi) / 2 + 1);\n\n            double ssi = (xsi + ysi) * -0.211324865405187;\n            double xi = xsi + ssi, yi = ysi + ssi;\n\n            // Point contributions\n            for (int i = 0; i < 3; i++)\n            {\n                LatticePoint2D c = LOOKUP_2D[index + i];\n\n                double dx = xi + c.dx, dy = yi + c.dy;\n                double attn = 0.5 - dx * dx - dy * dy;\n                if (attn <= 0) continue;\n\n                int pxm = (xsb + c.xsv) & PMASK, pym = (ysb + c.ysv) & PMASK;\n                Grad2 grad = permGrad2[perm[pxm] ^ pym];\n                double extrapolation = grad.dx * dx + grad.dy * dy;\n\n                attn *= attn;\n                value += attn * attn * extrapolation;\n            }\n\n            return value;\n        }\n\n        /**\n         * 3D Re-oriented 4-point BCC noise, classic orientation.\n         * Proper substitute for 3D Simplex in light of Forbidden Formulae.\n         * Use noise3_XYBeforeZ or noise3_XZBeforeY instead, wherever appropriate.\n         */\n        public double Noise3_Classic(double x, double y, double z)\n        {\n\n            // Re-orient the cubic lattices via rotation, to produce the expected look on cardinal planar slices.\n            // If texturing objects that don't tend to have cardinal plane faces, you could even remove this.\n            // Orthonormal rotation. Not a skew transform.\n            double r = (2.0 / 3.0) * (x + y + z);\n            double xr = r - x, yr = r - y, zr = r - z;\n\n            // Evaluate both lattices to form a BCC lattice.\n            return noise3_BCC(xr, yr, zr);\n        }\n\n        /**\n         * 3D Re-oriented 4-point BCC noise, with better visual isotropy in (X, Y).\n         * Recommended for 3D terrain and time-varied animations.\n         * The Z coordinate should always be the \"different\" coordinate in your use case.\n         * If Y is vertical in world coordinates, call noise3_XYBeforeZ(x, z, Y) or use noise3_XZBeforeY.\n         * If Z is vertical in world coordinates, call noise3_XYBeforeZ(x, y, Z).\n         * For a time varied animation, call noise3_XYBeforeZ(x, y, T).\n         */\n        public double Noise3_XYBeforeZ(double x, double y, double z)\n        {\n\n            // Re-orient the cubic lattices without skewing, to make X and Y triangular like 2D.\n            // Orthonormal rotation. Not a skew transform.\n            double xy = x + y;\n            double s2 = xy * -0.211324865405187;\n            double zz = z * 0.577350269189626;\n            double xr = x + s2 - zz, yr = y + s2 - zz;\n            double zr = xy * 0.577350269189626 + zz;\n\n            // Evaluate both lattices to form a BCC lattice.\n            return noise3_BCC(xr, yr, zr);\n        }\n\n        /**\n         * 3D Re-oriented 4-point BCC noise, with better visual isotropy in (X, Z).\n         * Recommended for 3D terrain and time-varied animations.\n         * The Y coordinate should always be the \"different\" coordinate in your use case.\n         * If Y is vertical in world coordinates, call noise3_XZBeforeY(x, Y, z).\n         * If Z is vertical in world coordinates, call noise3_XZBeforeY(x, Z, y) or use noise3_XYBeforeZ.\n         * For a time varied animation, call noise3_XZBeforeY(x, T, y) or use noise3_XYBeforeZ.\n         */\n        public double Noise3_XZBeforeY(double x, double y, double z)\n        {\n\n            // Re-orient the cubic lattices without skewing, to make X and Z triangular like 2D.\n            // Orthonormal rotation. Not a skew transform.\n            double xz = x + z;\n            double s2 = xz * -0.211324865405187;\n            double yy = y * 0.577350269189626;\n            double xr = x + s2 - yy; double zr = z + s2 - yy;\n            double yr = xz * 0.577350269189626 + yy;\n\n            // Evaluate both lattices to form a BCC lattice.\n            return noise3_BCC(xr, yr, zr);\n        }\n\n        /**\n         * Generate overlapping cubic lattices for 3D Re-oriented BCC noise.\n         * Lookup table implementation inspired by DigitalShadow.\n         * It was actually faster to narrow down the points in the loop itself,\n         * than to build up the index with enough info to isolate 4 points.\n         */\n        private double noise3_BCC(double xr, double yr, double zr)\n        {\n\n            // Get base and offsets inside cube of first lattice.\n            int xrb = fastFloor(xr), yrb = fastFloor(yr), zrb = fastFloor(zr);\n            double xri = xr - xrb, yri = yr - yrb, zri = zr - zrb;\n\n            // Identify which octant of the cube we're in. This determines which cell\n            // in the other cubic lattice we're in, and also narrows down one point on each.\n            int xht = (int)(xri + 0.5), yht = (int)(yri + 0.5), zht = (int)(zri + 0.5);\n            int index = (xht << 0) | (yht << 1) | (zht << 2);\n\n            // Point contributions\n            double value = 0;\n            LatticePoint3D c = LOOKUP_3D[index];\n            while (c != null)\n            {\n                double dxr = xri + c.dxr, dyr = yri + c.dyr, dzr = zri + c.dzr;\n                double attn = 0.5 - dxr * dxr - dyr * dyr - dzr * dzr;\n                if (attn < 0)\n                {\n                    c = c.NextOnFailure;\n                }\n                else\n                {\n                    int pxm = (xrb + c.xrv) & PMASK, pym = (yrb + c.yrv) & PMASK, pzm = (zrb + c.zrv) & PMASK;\n                    Grad3 grad = permGrad3[perm[perm[pxm] ^ pym] ^ pzm];\n                    double extrapolation = grad.dx * dxr + grad.dy * dyr + grad.dz * dzr;\n\n                    attn *= attn;\n                    value += attn * attn * extrapolation;\n                    c = c.NextOnSuccess;\n                }\n            }\n            return value;\n        }\n\n        /**\n         * 4D OpenSimplex2F noise, classic lattice orientation.\n         */\n        public double Noise4_Classic(double x, double y, double z, double w)\n        {\n\n            // Get points for A4 lattice\n            double s = -0.138196601125011 * (x + y + z + w);\n            double xs = x + s, ys = y + s, zs = z + s, ws = w + s;\n\n            return noise4_Base(xs, ys, zs, ws);\n        }\n\n        /**\n         * 4D OpenSimplex2F noise, with XY and ZW forming orthogonal triangular-based planes.\n         * Recommended for 3D terrain, where X and Y (or Z and W) are horizontal.\n         * Recommended for noise(x, y, sin(time), cos(time)) trick.\n         */\n        public double Noise4_XYBeforeZW(double x, double y, double z, double w)\n        {\n\n            double s2 = (x + y) * -0.178275657951399372 + (z + w) * 0.215623393288842828;\n            double t2 = (z + w) * -0.403949762580207112 + (x + y) * -0.375199083010075342;\n            double xs = x + s2, ys = y + s2, zs = z + t2, ws = w + t2;\n\n            return noise4_Base(xs, ys, zs, ws);\n        }\n\n        /**\n         * 4D OpenSimplex2F noise, with XZ and YW forming orthogonal triangular-based planes.\n         * Recommended for 3D terrain, where X and Z (or Y and W) are horizontal.\n         */\n        public double Noise4_XZBeforeYW(double x, double y, double z, double w)\n        {\n\n            double s2 = (x + z) * -0.178275657951399372 + (y + w) * 0.215623393288842828;\n            double t2 = (y + w) * -0.403949762580207112 + (x + z) * -0.375199083010075342;\n            double xs = x + s2, ys = y + t2, zs = z + s2, ws = w + t2;\n\n            return noise4_Base(xs, ys, zs, ws);\n        }\n\n        /**\n         * 4D OpenSimplex2F noise, with XYZ oriented like noise3_Classic,\n         * and W for an extra degree of freedom. W repeats eventually.\n         * Recommended for time-varied animations which texture a 3D object (W=time)\n         */\n        public double Noise4_XYZBeforeW(double x, double y, double z, double w)\n        {\n\n            double xyz = x + y + z;\n            double ww = w * 0.2236067977499788;\n            double s2 = xyz * -0.16666666666666666 + ww;\n            double xs = x + s2, ys = y + s2, zs = z + s2, ws = -0.5 * xyz + ww;\n\n            return noise4_Base(xs, ys, zs, ws);\n        }\n\n        /**\n         * 4D OpenSimplex2F noise base.\n         * Current implementation not fully optimized by lookup tables.\n         * But still comes out slightly ahead of Gustavson's Simplex in tests.\n         */\n        private double noise4_Base(double xs, double ys, double zs, double ws)\n        {\n            double value = 0;\n\n            // Get base points and offsets\n            int xsb = fastFloor(xs), ysb = fastFloor(ys), zsb = fastFloor(zs), wsb = fastFloor(ws);\n            double xsi = xs - xsb, ysi = ys - ysb, zsi = zs - zsb, wsi = ws - wsb;\n\n            // If we're in the lower half, flip so we can repeat the code for the upper half. We'll flip back later.\n            double siSum = xsi + ysi + zsi + wsi;\n            double ssi = siSum * 0.309016994374947; // Prep for vertex contributions.\n            bool inLowerHalf = (siSum < 2);\n            if (inLowerHalf)\n            {\n                xsi = 1 - xsi; ysi = 1 - ysi; zsi = 1 - zsi; wsi = 1 - wsi;\n                siSum = 4 - siSum;\n            }\n\n            // Consider opposing vertex pairs of the octahedron formed by the central cross-section of the stretched tesseract\n            double aabb = xsi + ysi - zsi - wsi, abab = xsi - ysi + zsi - wsi, abba = xsi - ysi - zsi + wsi;\n            double aabbScore = Math.Abs(aabb), ababScore = Math.Abs(abab), abbaScore = Math.Abs(abba);\n\n            // Find the closest point on the stretched tesseract as if it were the upper half\n            int vertexIndex, via, vib;\n            double asi, bsi;\n            if (aabbScore > ababScore && aabbScore > abbaScore)\n            {\n                if (aabb > 0)\n                {\n                    asi = zsi; bsi = wsi; vertexIndex = 0b0011; via = 0b0111; vib = 0b1011;\n                }\n                else\n                {\n                    asi = xsi; bsi = ysi; vertexIndex = 0b1100; via = 0b1101; vib = 0b1110;\n                }\n            }\n            else if (ababScore > abbaScore)\n            {\n                if (abab > 0)\n                {\n                    asi = ysi; bsi = wsi; vertexIndex = 0b0101; via = 0b0111; vib = 0b1101;\n                }\n                else\n                {\n                    asi = xsi; bsi = zsi; vertexIndex = 0b1010; via = 0b1011; vib = 0b1110;\n                }\n            }\n            else\n            {\n                if (abba > 0)\n                {\n                    asi = ysi; bsi = zsi; vertexIndex = 0b1001; via = 0b1011; vib = 0b1101;\n                }\n                else\n                {\n                    asi = xsi; bsi = wsi; vertexIndex = 0b0110; via = 0b0111; vib = 0b1110;\n                }\n            }\n            if (bsi > asi)\n            {\n                via = vib;\n                double temp = bsi;\n                bsi = asi;\n                asi = temp;\n            }\n            if (siSum + asi > 3)\n            {\n                vertexIndex = via;\n                if (siSum + bsi > 4)\n                {\n                    vertexIndex = 0b1111;\n                }\n            }\n\n            // Now flip back if we're actually in the lower half.\n            if (inLowerHalf)\n            {\n                xsi = 1 - xsi; ysi = 1 - ysi; zsi = 1 - zsi; wsi = 1 - wsi;\n                vertexIndex ^= 0b1111;\n            }\n\n            // Five points to add, total, from five copies of the A4 lattice.\n            for (int i = 0; i < 5; i++)\n            {\n\n                // Update xsb/etc. and add the lattice point's contribution.\n                LatticePoint4D c = VERTICES_4D[vertexIndex];\n                xsb += c.xsv; ysb += c.ysv; zsb += c.zsv; wsb += c.wsv;\n                double xi = xsi + ssi, yi = ysi + ssi, zi = zsi + ssi, wi = wsi + ssi;\n                double dx = xi + c.dx, dy = yi + c.dy, dz = zi + c.dz, dw = wi + c.dw;\n                double attn = 0.5 - dx * dx - dy * dy - dz * dz - dw * dw;\n                if (attn > 0)\n                {\n                    int pxm = xsb & PMASK, pym = ysb & PMASK, pzm = zsb & PMASK, pwm = wsb & PMASK;\n                    Grad4 grad = permGrad4[perm[perm[perm[pxm] ^ pym] ^ pzm] ^ pwm];\n                    double ramped = grad.dx * dx + grad.dy * dy + grad.dz * dz + grad.dw * dw;\n\n                    attn *= attn;\n                    value += attn * attn * ramped;\n                }\n\n                // Maybe this helps the compiler/JVM/LLVM/etc. know we can end the loop here. Maybe not.\n                if (i == 4) break;\n\n                // Update the relative skewed coordinates to reference the vertex we just added.\n                // Rather, reference its counterpart on the lattice copy that is shifted down by\n                // the vector <-0.2, -0.2, -0.2, -0.2>\n                xsi += c.xsi; ysi += c.ysi; zsi += c.zsi; wsi += c.wsi;\n                ssi += c.ssiDelta;\n\n                // Next point is the closest vertex on the 4-simplex whose base vertex is the aforementioned vertex.\n                double score0 = 1.0 + ssi * (-1.0 / 0.309016994374947); // Seems slightly faster than 1.0-xsi-ysi-zsi-wsi\n                vertexIndex = 0b0000;\n                if (xsi >= ysi && xsi >= zsi && xsi >= wsi && xsi >= score0)\n                {\n                    vertexIndex = 0b0001;\n                }\n                else if (ysi > xsi && ysi >= zsi && ysi >= wsi && ysi >= score0)\n                {\n                    vertexIndex = 0b0010;\n                }\n                else if (zsi > xsi && zsi > ysi && zsi >= wsi && zsi >= score0)\n                {\n                    vertexIndex = 0b0100;\n                }\n                else if (wsi > xsi && wsi > ysi && wsi > zsi && wsi >= score0)\n                {\n                    vertexIndex = 0b1000;\n                }\n            }\n\n            return value;\n        }\n\n        /*\n         * Utility\n         */\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        private static int fastFloor(double x)\n        {\n            int xi = (int)x;\n            return x < xi ? xi - 1 : xi;\n        }\n\n        /*\n         * Lookup Tables & Gradients\n         */\n\n        private static LatticePoint2D[] LOOKUP_2D;\n        private static LatticePoint3D[] LOOKUP_3D;\n        private static LatticePoint4D[] VERTICES_4D;\n\n        private const double N2 = 0.01001634121365712;\n        private const double N3 = 0.030485933181293584;\n        private const double N4 = 0.009202377986303158;\n        private static Grad2[] GRADIENTS_2D;\n        private static Grad3[] GRADIENTS_3D;\n        private static Grad4[] GRADIENTS_4D;\n\n        static OpenSimplex2F()\n        {\n            LOOKUP_2D = new LatticePoint2D[4];\n            LOOKUP_3D = new LatticePoint3D[8];\n            VERTICES_4D = new LatticePoint4D[16];\n            \n            LOOKUP_2D[0] = new LatticePoint2D(1, 0);\n            LOOKUP_2D[1] = new LatticePoint2D(0, 0);\n            LOOKUP_2D[2] = new LatticePoint2D(1, 1);\n            LOOKUP_2D[3] = new LatticePoint2D(0, 1);\n\n            for (int i = 0; i < 8; i++)\n            {\n                int i1, j1, k1, i2, j2, k2;\n                i1 = (i >> 0) & 1; j1 = (i >> 1) & 1; k1 = (i >> 2) & 1;\n                i2 = i1 ^ 1; j2 = j1 ^ 1; k2 = k1 ^ 1;\n\n                // The two points within this octant, one from each of the two cubic half-lattices.\n                LatticePoint3D c0 = new LatticePoint3D(i1, j1, k1, 0);\n                LatticePoint3D c1 = new LatticePoint3D(i1 + i2, j1 + j2, k1 + k2, 1);\n\n                // Each single step away on the first half-lattice.\n                LatticePoint3D c2 = new LatticePoint3D(i1 ^ 1, j1, k1, 0);\n                LatticePoint3D c3 = new LatticePoint3D(i1, j1 ^ 1, k1, 0);\n                LatticePoint3D c4 = new LatticePoint3D(i1, j1, k1 ^ 1, 0);\n\n                // Each single step away on the second half-lattice.\n                LatticePoint3D c5 = new LatticePoint3D(i1 + (i2 ^ 1), j1 + j2, k1 + k2, 1);\n                LatticePoint3D c6 = new LatticePoint3D(i1 + i2, j1 + (j2 ^ 1), k1 + k2, 1);\n                LatticePoint3D c7 = new LatticePoint3D(i1 + i2, j1 + j2, k1 + (k2 ^ 1), 1);\n\n                // First two are guaranteed.\n                c0.NextOnFailure = c0.NextOnSuccess = c1;\n                c1.NextOnFailure = c1.NextOnSuccess = c2;\n\n                // Once we find one on the first half-lattice, the rest are out.\n                // In addition, knowing c2 rules out c5.\n                c2.NextOnFailure = c3; c2.NextOnSuccess = c6;\n                c3.NextOnFailure = c4; c3.NextOnSuccess = c5;\n                c4.NextOnFailure = c4.NextOnSuccess = c5;\n\n                // Once we find one on the second half-lattice, the rest are out.\n                c5.NextOnFailure = c6; c5.NextOnSuccess = null;\n                c6.NextOnFailure = c7; c6.NextOnSuccess = null;\n                c7.NextOnFailure = c7.NextOnSuccess = null;\n\n                LOOKUP_3D[i] = c0;\n            }\n\n            for (int i = 0; i < 16; i++)\n            {\n                VERTICES_4D[i] = new LatticePoint4D((i >> 0) & 1, (i >> 1) & 1, (i >> 2) & 1, (i >> 3) & 1);\n            }\n\n            GRADIENTS_2D = new Grad2[PSIZE];\n            Grad2[] grad2 = {\n                new Grad2( 0.130526192220052,  0.99144486137381),\n                new Grad2( 0.38268343236509,   0.923879532511287),\n                new Grad2( 0.608761429008721,  0.793353340291235),\n                new Grad2( 0.793353340291235,  0.608761429008721),\n                new Grad2( 0.923879532511287,  0.38268343236509),\n                new Grad2( 0.99144486137381,   0.130526192220051),\n                new Grad2( 0.99144486137381,  -0.130526192220051),\n                new Grad2( 0.923879532511287, -0.38268343236509),\n                new Grad2( 0.793353340291235, -0.60876142900872),\n                new Grad2( 0.608761429008721, -0.793353340291235),\n                new Grad2( 0.38268343236509,  -0.923879532511287),\n                new Grad2( 0.130526192220052, -0.99144486137381),\n                new Grad2(-0.130526192220052, -0.99144486137381),\n                new Grad2(-0.38268343236509,  -0.923879532511287),\n                new Grad2(-0.608761429008721, -0.793353340291235),\n                new Grad2(-0.793353340291235, -0.608761429008721),\n                new Grad2(-0.923879532511287, -0.38268343236509),\n                new Grad2(-0.99144486137381,  -0.130526192220052),\n                new Grad2(-0.99144486137381,   0.130526192220051),\n                new Grad2(-0.923879532511287,  0.38268343236509),\n                new Grad2(-0.793353340291235,  0.608761429008721),\n                new Grad2(-0.608761429008721,  0.793353340291235),\n                new Grad2(-0.38268343236509,   0.923879532511287),\n                new Grad2(-0.130526192220052,  0.99144486137381)\n            };\n            for (int i = 0; i < grad2.Length; i++)\n            {\n                grad2[i].dx /= N2; grad2[i].dy /= N2;\n            }\n            for (int i = 0; i < PSIZE; i++)\n            {\n                GRADIENTS_2D[i] = grad2[i % grad2.Length];\n            }\n\n            GRADIENTS_3D = new Grad3[PSIZE];\n            Grad3[] grad3 = {\n                new Grad3(-2.22474487139,      -2.22474487139,      -1.0),\n                new Grad3(-2.22474487139,      -2.22474487139,       1.0),\n                new Grad3(-3.0862664687972017, -1.1721513422464978,  0.0),\n                new Grad3(-1.1721513422464978, -3.0862664687972017,  0.0),\n                new Grad3(-2.22474487139,      -1.0,                -2.22474487139),\n                new Grad3(-2.22474487139,       1.0,                -2.22474487139),\n                new Grad3(-1.1721513422464978,  0.0,                -3.0862664687972017),\n                new Grad3(-3.0862664687972017,  0.0,                -1.1721513422464978),\n                new Grad3(-2.22474487139,      -1.0,                 2.22474487139),\n                new Grad3(-2.22474487139,       1.0,                 2.22474487139),\n                new Grad3(-3.0862664687972017,  0.0,                 1.1721513422464978),\n                new Grad3(-1.1721513422464978,  0.0,                 3.0862664687972017),\n                new Grad3(-2.22474487139,       2.22474487139,      -1.0),\n                new Grad3(-2.22474487139,       2.22474487139,       1.0),\n                new Grad3(-1.1721513422464978,  3.0862664687972017,  0.0),\n                new Grad3(-3.0862664687972017,  1.1721513422464978,  0.0),\n                new Grad3(-1.0,                -2.22474487139,      -2.22474487139),\n                new Grad3( 1.0,                -2.22474487139,      -2.22474487139),\n                new Grad3( 0.0,                -3.0862664687972017, -1.1721513422464978),\n                new Grad3( 0.0,                -1.1721513422464978, -3.0862664687972017),\n                new Grad3(-1.0,                -2.22474487139,       2.22474487139),\n                new Grad3( 1.0,                -2.22474487139,       2.22474487139),\n                new Grad3( 0.0,                -1.1721513422464978,  3.0862664687972017),\n                new Grad3( 0.0,                -3.0862664687972017,  1.1721513422464978),\n                new Grad3(-1.0,                 2.22474487139,      -2.22474487139),\n                new Grad3( 1.0,                 2.22474487139,      -2.22474487139),\n                new Grad3( 0.0,                 1.1721513422464978, -3.0862664687972017),\n                new Grad3( 0.0,                 3.0862664687972017, -1.1721513422464978),\n                new Grad3(-1.0,                 2.22474487139,       2.22474487139),\n                new Grad3( 1.0,                 2.22474487139,       2.22474487139),\n                new Grad3( 0.0,                 3.0862664687972017,  1.1721513422464978),\n                new Grad3( 0.0,                 1.1721513422464978,  3.0862664687972017),\n                new Grad3( 2.22474487139,      -2.22474487139,      -1.0),\n                new Grad3( 2.22474487139,      -2.22474487139,       1.0),\n                new Grad3( 1.1721513422464978, -3.0862664687972017,  0.0),\n                new Grad3( 3.0862664687972017, -1.1721513422464978,  0.0),\n                new Grad3( 2.22474487139,      -1.0,                -2.22474487139),\n                new Grad3( 2.22474487139,       1.0,                -2.22474487139),\n                new Grad3( 3.0862664687972017,  0.0,                -1.1721513422464978),\n                new Grad3( 1.1721513422464978,  0.0,                -3.0862664687972017),\n                new Grad3( 2.22474487139,      -1.0,                 2.22474487139),\n                new Grad3( 2.22474487139,       1.0,                 2.22474487139),\n                new Grad3( 1.1721513422464978,  0.0,                 3.0862664687972017),\n                new Grad3( 3.0862664687972017,  0.0,                 1.1721513422464978),\n                new Grad3( 2.22474487139,       2.22474487139,      -1.0),\n                new Grad3( 2.22474487139,       2.22474487139,       1.0),\n                new Grad3( 3.0862664687972017,  1.1721513422464978,  0.0),\n                new Grad3( 1.1721513422464978,  3.0862664687972017,  0.0)\n            };\n            for (int i = 0; i < grad3.Length; i++)\n            {\n                grad3[i].dx /= N3; grad3[i].dy /= N3; grad3[i].dz /= N3;\n            }\n            for (int i = 0; i < PSIZE; i++)\n            {\n                GRADIENTS_3D[i] = grad3[i % grad3.Length];\n            }\n\n            GRADIENTS_4D = new Grad4[PSIZE];\n            Grad4[] grad4 = {\n                new Grad4(-0.753341017856078,    -0.37968289875261624,  -0.37968289875261624,  -0.37968289875261624),\n                new Grad4(-0.7821684431180708,   -0.4321472685365301,   -0.4321472685365301,    0.12128480194602098),\n                new Grad4(-0.7821684431180708,   -0.4321472685365301,    0.12128480194602098,  -0.4321472685365301),\n                new Grad4(-0.7821684431180708,    0.12128480194602098,  -0.4321472685365301,   -0.4321472685365301),\n                new Grad4(-0.8586508742123365,   -0.508629699630796,     0.044802370851755174,  0.044802370851755174),\n                new Grad4(-0.8586508742123365,    0.044802370851755174, -0.508629699630796,     0.044802370851755174),\n                new Grad4(-0.8586508742123365,    0.044802370851755174,  0.044802370851755174, -0.508629699630796),\n                new Grad4(-0.9982828964265062,   -0.03381941603233842,  -0.03381941603233842,  -0.03381941603233842),\n                new Grad4(-0.37968289875261624,  -0.753341017856078,    -0.37968289875261624,  -0.37968289875261624),\n                new Grad4(-0.4321472685365301,   -0.7821684431180708,   -0.4321472685365301,    0.12128480194602098),\n                new Grad4(-0.4321472685365301,   -0.7821684431180708,    0.12128480194602098,  -0.4321472685365301),\n                new Grad4( 0.12128480194602098,  -0.7821684431180708,   -0.4321472685365301,   -0.4321472685365301),\n                new Grad4(-0.508629699630796,    -0.8586508742123365,    0.044802370851755174,  0.044802370851755174),\n                new Grad4( 0.044802370851755174, -0.8586508742123365,   -0.508629699630796,     0.044802370851755174),\n                new Grad4( 0.044802370851755174, -0.8586508742123365,    0.044802370851755174, -0.508629699630796),\n                new Grad4(-0.03381941603233842,  -0.9982828964265062,   -0.03381941603233842,  -0.03381941603233842),\n                new Grad4(-0.37968289875261624,  -0.37968289875261624,  -0.753341017856078,    -0.37968289875261624),\n                new Grad4(-0.4321472685365301,   -0.4321472685365301,   -0.7821684431180708,    0.12128480194602098),\n                new Grad4(-0.4321472685365301,    0.12128480194602098,  -0.7821684431180708,   -0.4321472685365301),\n                new Grad4( 0.12128480194602098,  -0.4321472685365301,   -0.7821684431180708,   -0.4321472685365301),\n                new Grad4(-0.508629699630796,     0.044802370851755174, -0.8586508742123365,    0.044802370851755174),\n                new Grad4( 0.044802370851755174, -0.508629699630796,    -0.8586508742123365,    0.044802370851755174),\n                new Grad4( 0.044802370851755174,  0.044802370851755174, -0.8586508742123365,   -0.508629699630796),\n                new Grad4(-0.03381941603233842,  -0.03381941603233842,  -0.9982828964265062,   -0.03381941603233842),\n                new Grad4(-0.37968289875261624,  -0.37968289875261624,  -0.37968289875261624,  -0.753341017856078),\n                new Grad4(-0.4321472685365301,   -0.4321472685365301,    0.12128480194602098,  -0.7821684431180708),\n                new Grad4(-0.4321472685365301,    0.12128480194602098,  -0.4321472685365301,   -0.7821684431180708),\n                new Grad4( 0.12128480194602098,  -0.4321472685365301,   -0.4321472685365301,   -0.7821684431180708),\n                new Grad4(-0.508629699630796,     0.044802370851755174,  0.044802370851755174, -0.8586508742123365),\n                new Grad4( 0.044802370851755174, -0.508629699630796,     0.044802370851755174, -0.8586508742123365),\n                new Grad4( 0.044802370851755174,  0.044802370851755174, -0.508629699630796,    -0.8586508742123365),\n                new Grad4(-0.03381941603233842,  -0.03381941603233842,  -0.03381941603233842,  -0.9982828964265062),\n                new Grad4(-0.6740059517812944,   -0.3239847771997537,   -0.3239847771997537,    0.5794684678643381),\n                new Grad4(-0.7504883828755602,   -0.4004672082940195,    0.15296486218853164,   0.5029860367700724),\n                new Grad4(-0.7504883828755602,    0.15296486218853164,  -0.4004672082940195,    0.5029860367700724),\n                new Grad4(-0.8828161875373585,    0.08164729285680945,   0.08164729285680945,   0.4553054119602712),\n                new Grad4(-0.4553054119602712,   -0.08164729285680945,  -0.08164729285680945,   0.8828161875373585),\n                new Grad4(-0.5029860367700724,   -0.15296486218853164,   0.4004672082940195,    0.7504883828755602),\n                new Grad4(-0.5029860367700724,    0.4004672082940195,   -0.15296486218853164,   0.7504883828755602),\n                new Grad4(-0.5794684678643381,    0.3239847771997537,    0.3239847771997537,    0.6740059517812944),\n                new Grad4(-0.3239847771997537,   -0.6740059517812944,   -0.3239847771997537,    0.5794684678643381),\n                new Grad4(-0.4004672082940195,   -0.7504883828755602,    0.15296486218853164,   0.5029860367700724),\n                new Grad4( 0.15296486218853164,  -0.7504883828755602,   -0.4004672082940195,    0.5029860367700724),\n                new Grad4( 0.08164729285680945,  -0.8828161875373585,    0.08164729285680945,   0.4553054119602712),\n                new Grad4(-0.08164729285680945,  -0.4553054119602712,   -0.08164729285680945,   0.8828161875373585),\n                new Grad4(-0.15296486218853164,  -0.5029860367700724,    0.4004672082940195,    0.7504883828755602),\n                new Grad4( 0.4004672082940195,   -0.5029860367700724,   -0.15296486218853164,   0.7504883828755602),\n                new Grad4( 0.3239847771997537,   -0.5794684678643381,    0.3239847771997537,    0.6740059517812944),\n                new Grad4(-0.3239847771997537,   -0.3239847771997537,   -0.6740059517812944,    0.5794684678643381),\n                new Grad4(-0.4004672082940195,    0.15296486218853164,  -0.7504883828755602,    0.5029860367700724),\n                new Grad4( 0.15296486218853164,  -0.4004672082940195,   -0.7504883828755602,    0.5029860367700724),\n                new Grad4( 0.08164729285680945,   0.08164729285680945,  -0.8828161875373585,    0.4553054119602712),\n                new Grad4(-0.08164729285680945,  -0.08164729285680945,  -0.4553054119602712,    0.8828161875373585),\n                new Grad4(-0.15296486218853164,   0.4004672082940195,   -0.5029860367700724,    0.7504883828755602),\n                new Grad4( 0.4004672082940195,   -0.15296486218853164,  -0.5029860367700724,    0.7504883828755602),\n                new Grad4( 0.3239847771997537,    0.3239847771997537,   -0.5794684678643381,    0.6740059517812944),\n                new Grad4(-0.6740059517812944,   -0.3239847771997537,    0.5794684678643381,   -0.3239847771997537),\n                new Grad4(-0.7504883828755602,   -0.4004672082940195,    0.5029860367700724,    0.15296486218853164),\n                new Grad4(-0.7504883828755602,    0.15296486218853164,   0.5029860367700724,   -0.4004672082940195),\n                new Grad4(-0.8828161875373585,    0.08164729285680945,   0.4553054119602712,    0.08164729285680945),\n                new Grad4(-0.4553054119602712,   -0.08164729285680945,   0.8828161875373585,   -0.08164729285680945),\n                new Grad4(-0.5029860367700724,   -0.15296486218853164,   0.7504883828755602,    0.4004672082940195),\n                new Grad4(-0.5029860367700724,    0.4004672082940195,    0.7504883828755602,   -0.15296486218853164),\n                new Grad4(-0.5794684678643381,    0.3239847771997537,    0.6740059517812944,    0.3239847771997537),\n                new Grad4(-0.3239847771997537,   -0.6740059517812944,    0.5794684678643381,   -0.3239847771997537),\n                new Grad4(-0.4004672082940195,   -0.7504883828755602,    0.5029860367700724,    0.15296486218853164),\n                new Grad4( 0.15296486218853164,  -0.7504883828755602,    0.5029860367700724,   -0.4004672082940195),\n                new Grad4( 0.08164729285680945,  -0.8828161875373585,    0.4553054119602712,    0.08164729285680945),\n                new Grad4(-0.08164729285680945,  -0.4553054119602712,    0.8828161875373585,   -0.08164729285680945),\n                new Grad4(-0.15296486218853164,  -0.5029860367700724,    0.7504883828755602,    0.4004672082940195),\n                new Grad4( 0.4004672082940195,   -0.5029860367700724,    0.7504883828755602,   -0.15296486218853164),\n                new Grad4( 0.3239847771997537,   -0.5794684678643381,    0.6740059517812944,    0.3239847771997537),\n                new Grad4(-0.3239847771997537,   -0.3239847771997537,    0.5794684678643381,   -0.6740059517812944),\n                new Grad4(-0.4004672082940195,    0.15296486218853164,   0.5029860367700724,   -0.7504883828755602),\n                new Grad4( 0.15296486218853164,  -0.4004672082940195,    0.5029860367700724,   -0.7504883828755602),\n                new Grad4( 0.08164729285680945,   0.08164729285680945,   0.4553054119602712,   -0.8828161875373585),\n                new Grad4(-0.08164729285680945,  -0.08164729285680945,   0.8828161875373585,   -0.4553054119602712),\n                new Grad4(-0.15296486218853164,   0.4004672082940195,    0.7504883828755602,   -0.5029860367700724),\n                new Grad4( 0.4004672082940195,   -0.15296486218853164,   0.7504883828755602,   -0.5029860367700724),\n                new Grad4( 0.3239847771997537,    0.3239847771997537,    0.6740059517812944,   -0.5794684678643381),\n                new Grad4(-0.6740059517812944,    0.5794684678643381,   -0.3239847771997537,   -0.3239847771997537),\n                new Grad4(-0.7504883828755602,    0.5029860367700724,   -0.4004672082940195,    0.15296486218853164),\n                new Grad4(-0.7504883828755602,    0.5029860367700724,    0.15296486218853164,  -0.4004672082940195),\n                new Grad4(-0.8828161875373585,    0.4553054119602712,    0.08164729285680945,   0.08164729285680945),\n                new Grad4(-0.4553054119602712,    0.8828161875373585,   -0.08164729285680945,  -0.08164729285680945),\n                new Grad4(-0.5029860367700724,    0.7504883828755602,   -0.15296486218853164,   0.4004672082940195),\n                new Grad4(-0.5029860367700724,    0.7504883828755602,    0.4004672082940195,   -0.15296486218853164),\n                new Grad4(-0.5794684678643381,    0.6740059517812944,    0.3239847771997537,    0.3239847771997537),\n                new Grad4(-0.3239847771997537,    0.5794684678643381,   -0.6740059517812944,   -0.3239847771997537),\n                new Grad4(-0.4004672082940195,    0.5029860367700724,   -0.7504883828755602,    0.15296486218853164),\n                new Grad4( 0.15296486218853164,   0.5029860367700724,   -0.7504883828755602,   -0.4004672082940195),\n                new Grad4( 0.08164729285680945,   0.4553054119602712,   -0.8828161875373585,    0.08164729285680945),\n                new Grad4(-0.08164729285680945,   0.8828161875373585,   -0.4553054119602712,   -0.08164729285680945),\n                new Grad4(-0.15296486218853164,   0.7504883828755602,   -0.5029860367700724,    0.4004672082940195),\n                new Grad4( 0.4004672082940195,    0.7504883828755602,   -0.5029860367700724,   -0.15296486218853164),\n                new Grad4( 0.3239847771997537,    0.6740059517812944,   -0.5794684678643381,    0.3239847771997537),\n                new Grad4(-0.3239847771997537,    0.5794684678643381,   -0.3239847771997537,   -0.6740059517812944),\n                new Grad4(-0.4004672082940195,    0.5029860367700724,    0.15296486218853164,  -0.7504883828755602),\n                new Grad4( 0.15296486218853164,   0.5029860367700724,   -0.4004672082940195,   -0.7504883828755602),\n                new Grad4( 0.08164729285680945,   0.4553054119602712,    0.08164729285680945,  -0.8828161875373585),\n                new Grad4(-0.08164729285680945,   0.8828161875373585,   -0.08164729285680945,  -0.4553054119602712),\n                new Grad4(-0.15296486218853164,   0.7504883828755602,    0.4004672082940195,   -0.5029860367700724),\n                new Grad4( 0.4004672082940195,    0.7504883828755602,   -0.15296486218853164,  -0.5029860367700724),\n                new Grad4( 0.3239847771997537,    0.6740059517812944,    0.3239847771997537,   -0.5794684678643381),\n                new Grad4( 0.5794684678643381,   -0.6740059517812944,   -0.3239847771997537,   -0.3239847771997537),\n                new Grad4( 0.5029860367700724,   -0.7504883828755602,   -0.4004672082940195,    0.15296486218853164),\n                new Grad4( 0.5029860367700724,   -0.7504883828755602,    0.15296486218853164,  -0.4004672082940195),\n                new Grad4( 0.4553054119602712,   -0.8828161875373585,    0.08164729285680945,   0.08164729285680945),\n                new Grad4( 0.8828161875373585,   -0.4553054119602712,   -0.08164729285680945,  -0.08164729285680945),\n                new Grad4( 0.7504883828755602,   -0.5029860367700724,   -0.15296486218853164,   0.4004672082940195),\n                new Grad4( 0.7504883828755602,   -0.5029860367700724,    0.4004672082940195,   -0.15296486218853164),\n                new Grad4( 0.6740059517812944,   -0.5794684678643381,    0.3239847771997537,    0.3239847771997537),\n                new Grad4( 0.5794684678643381,   -0.3239847771997537,   -0.6740059517812944,   -0.3239847771997537),\n                new Grad4( 0.5029860367700724,   -0.4004672082940195,   -0.7504883828755602,    0.15296486218853164),\n                new Grad4( 0.5029860367700724,    0.15296486218853164,  -0.7504883828755602,   -0.4004672082940195),\n                new Grad4( 0.4553054119602712,    0.08164729285680945,  -0.8828161875373585,    0.08164729285680945),\n                new Grad4( 0.8828161875373585,   -0.08164729285680945,  -0.4553054119602712,   -0.08164729285680945),\n                new Grad4( 0.7504883828755602,   -0.15296486218853164,  -0.5029860367700724,    0.4004672082940195),\n                new Grad4( 0.7504883828755602,    0.4004672082940195,   -0.5029860367700724,   -0.15296486218853164),\n                new Grad4( 0.6740059517812944,    0.3239847771997537,   -0.5794684678643381,    0.3239847771997537),\n                new Grad4( 0.5794684678643381,   -0.3239847771997537,   -0.3239847771997537,   -0.6740059517812944),\n                new Grad4( 0.5029860367700724,   -0.4004672082940195,    0.15296486218853164,  -0.7504883828755602),\n                new Grad4( 0.5029860367700724,    0.15296486218853164,  -0.4004672082940195,   -0.7504883828755602),\n                new Grad4( 0.4553054119602712,    0.08164729285680945,   0.08164729285680945,  -0.8828161875373585),\n                new Grad4( 0.8828161875373585,   -0.08164729285680945,  -0.08164729285680945,  -0.4553054119602712),\n                new Grad4( 0.7504883828755602,   -0.15296486218853164,   0.4004672082940195,   -0.5029860367700724),\n                new Grad4( 0.7504883828755602,    0.4004672082940195,   -0.15296486218853164,  -0.5029860367700724),\n                new Grad4( 0.6740059517812944,    0.3239847771997537,    0.3239847771997537,   -0.5794684678643381),\n                new Grad4( 0.03381941603233842,   0.03381941603233842,   0.03381941603233842,   0.9982828964265062),\n                new Grad4(-0.044802370851755174, -0.044802370851755174,  0.508629699630796,     0.8586508742123365),\n                new Grad4(-0.044802370851755174,  0.508629699630796,    -0.044802370851755174,  0.8586508742123365),\n                new Grad4(-0.12128480194602098,   0.4321472685365301,    0.4321472685365301,    0.7821684431180708),\n                new Grad4( 0.508629699630796,    -0.044802370851755174, -0.044802370851755174,  0.8586508742123365),\n                new Grad4( 0.4321472685365301,   -0.12128480194602098,   0.4321472685365301,    0.7821684431180708),\n                new Grad4( 0.4321472685365301,    0.4321472685365301,   -0.12128480194602098,   0.7821684431180708),\n                new Grad4( 0.37968289875261624,   0.37968289875261624,   0.37968289875261624,   0.753341017856078),\n                new Grad4( 0.03381941603233842,   0.03381941603233842,   0.9982828964265062,    0.03381941603233842),\n                new Grad4(-0.044802370851755174,  0.044802370851755174,  0.8586508742123365,    0.508629699630796),\n                new Grad4(-0.044802370851755174,  0.508629699630796,     0.8586508742123365,   -0.044802370851755174),\n                new Grad4(-0.12128480194602098,   0.4321472685365301,    0.7821684431180708,    0.4321472685365301),\n                new Grad4( 0.508629699630796,    -0.044802370851755174,  0.8586508742123365,   -0.044802370851755174),\n                new Grad4( 0.4321472685365301,   -0.12128480194602098,   0.7821684431180708,    0.4321472685365301),\n                new Grad4( 0.4321472685365301,    0.4321472685365301,    0.7821684431180708,   -0.12128480194602098),\n                new Grad4( 0.37968289875261624,   0.37968289875261624,   0.753341017856078,     0.37968289875261624),\n                new Grad4( 0.03381941603233842,   0.9982828964265062,    0.03381941603233842,   0.03381941603233842),\n                new Grad4(-0.044802370851755174,  0.8586508742123365,   -0.044802370851755174,  0.508629699630796),\n                new Grad4(-0.044802370851755174,  0.8586508742123365,    0.508629699630796,    -0.044802370851755174),\n                new Grad4(-0.12128480194602098,   0.7821684431180708,    0.4321472685365301,    0.4321472685365301),\n                new Grad4( 0.508629699630796,     0.8586508742123365,   -0.044802370851755174, -0.044802370851755174),\n                new Grad4( 0.4321472685365301,    0.7821684431180708,   -0.12128480194602098,   0.4321472685365301),\n                new Grad4( 0.4321472685365301,    0.7821684431180708,    0.4321472685365301,   -0.12128480194602098),\n                new Grad4( 0.37968289875261624,   0.753341017856078,     0.37968289875261624,   0.37968289875261624),\n                new Grad4( 0.9982828964265062,    0.03381941603233842,   0.03381941603233842,   0.03381941603233842),\n                new Grad4( 0.8586508742123365,   -0.044802370851755174, -0.044802370851755174,  0.508629699630796),\n                new Grad4( 0.8586508742123365,   -0.044802370851755174,  0.508629699630796,    -0.044802370851755174),\n                new Grad4( 0.7821684431180708,   -0.12128480194602098,   0.4321472685365301,    0.4321472685365301),\n                new Grad4( 0.8586508742123365,    0.508629699630796,    -0.044802370851755174, -0.044802370851755174),\n                new Grad4( 0.7821684431180708,    0.4321472685365301,   -0.12128480194602098,   0.4321472685365301),\n                new Grad4( 0.7821684431180708,    0.4321472685365301,    0.4321472685365301,   -0.12128480194602098),\n                new Grad4( 0.753341017856078,     0.37968289875261624,   0.37968289875261624,   0.37968289875261624)\n            };\n            for (int i = 0; i < grad4.Length; i++)\n            {\n                grad4[i].dx /= N4; grad4[i].dy /= N4; grad4[i].dz /= N4; grad4[i].dw /= N4;\n            }\n            for (int i = 0; i < PSIZE; i++)\n            {\n                GRADIENTS_4D[i] = grad4[i % grad4.Length];\n            }\n        }\n\n        private struct LatticePoint2D\n        {\n            public int xsv, ysv;\n            public double dx, dy;\n            public LatticePoint2D(int xsv, int ysv)\n            {\n                this.xsv = xsv; this.ysv = ysv;\n                double ssv = (xsv + ysv) * -0.211324865405187;\n                this.dx = -xsv - ssv;\n                this.dy = -ysv - ssv;\n            }\n        }\n\n        private class LatticePoint3D\n        {\n            public double dxr, dyr, dzr;\n            public int xrv, yrv, zrv;\n            public LatticePoint3D NextOnFailure, NextOnSuccess;\n            public LatticePoint3D(int xrv, int yrv, int zrv, int lattice)\n            {\n                this.dxr = -xrv + lattice * 0.5; this.dyr = -yrv + lattice * 0.5; this.dzr = -zrv + lattice * 0.5;\n                this.xrv = xrv + lattice * 1024; this.yrv = yrv + lattice * 1024; this.zrv = zrv + lattice * 1024;\n            }\n        }\n\n        private struct LatticePoint4D\n        {\n            public int xsv, ysv, zsv, wsv;\n            public double dx, dy, dz, dw;\n            public double xsi, ysi, zsi, wsi;\n            public double ssiDelta;\n            public LatticePoint4D(int xsv, int ysv, int zsv, int wsv)\n            {\n                this.xsv = xsv + 409; this.ysv = ysv + 409; this.zsv = zsv + 409; this.wsv = wsv + 409;\n                double ssv = (xsv + ysv + zsv + wsv) * 0.309016994374947;\n                this.dx = -xsv - ssv;\n                this.dy = -ysv - ssv;\n                this.dz = -zsv - ssv;\n                this.dw = -wsv - ssv;\n                this.xsi = xsi = 0.2 - xsv;\n                this.ysi = ysi = 0.2 - ysv;\n                this.zsi = zsi = 0.2 - zsv;\n                this.wsi = wsi = 0.2 - wsv;\n                this.ssiDelta = (0.8 - xsv - ysv - zsv - wsv) * 0.309016994374947;\n            }\n        }\n\n        private struct Grad2\n        {\n            public double dx, dy;\n            public Grad2(double dx, double dy)\n            {\n                this.dx = dx; this.dy = dy;\n            }\n        }\n\n        private struct Grad3\n        {\n            public double dx, dy, dz;\n            public Grad3(double dx, double dy, double dz)\n            {\n                this.dx = dx; this.dy = dy; this.dz = dz;\n            }\n        }\n\n        private struct Grad4\n        {\n            public double dx, dy, dz, dw;\n            public Grad4(double dx, double dy, double dz, double dw)\n            {\n                this.dx = dx; this.dy = dy; this.dz = dz; this.dw = dw;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "_old/csharp/OpenSimplex2S.cs",
    "content": "﻿/**\n * K.jpg's OpenSimplex 2, smooth variant (\"SuperSimplex\")\n *\n * - 2D is standard simplex, modified to support larger kernels.\n *   Implemented using a lookup table.\n * - 3D is \"Re-oriented 8-point BCC noise\" which constructs a\n *   congruent BCC lattice in a much different way than usual.\n * - 4D uses a naïve pregenerated lookup table, and averages out\n *   to the expected performance.\n *\n * Multiple versions of each function are provided. See the\n * documentation above each, for more info.\n */\n\nusing System.Runtime.CompilerServices;\n\nnamespace Noise\n{\n    public class OpenSimplex2S\n    {\n        private const int PSIZE = 2048;\n        private const int PMASK = 2047;\n\n        private short[] perm;\n        private Grad2[] permGrad2;\n        private Grad3[] permGrad3;\n        private Grad4[] permGrad4;\n\n        public OpenSimplex2S(long seed)\n        {\n            perm = new short[PSIZE];\n            permGrad2 = new Grad2[PSIZE];\n            permGrad3 = new Grad3[PSIZE];\n            permGrad4 = new Grad4[PSIZE];\n            short[] source = new short[PSIZE];\n            for (short i = 0; i < PSIZE; i++)\n                source[i] = i;\n            for (int i = PSIZE - 1; i >= 0; i--)\n            {\n                seed = seed * 6364136223846793005L + 1442695040888963407L;\n                int r = (int)((seed + 31) % (i + 1));\n                if (r < 0)\n                    r += (i + 1);\n                perm[i] = source[r];\n                permGrad2[i] = GRADIENTS_2D[perm[i]];\n                permGrad3[i] = GRADIENTS_3D[perm[i]];\n                permGrad4[i] = GRADIENTS_4D[perm[i]];\n                source[r] = source[i];\n            }\n        }\n\n        /*\n         * Noise Evaluators\n         */\n\n        /**\n         * 2D SuperSimplex noise, standard lattice orientation.\n         */\n        public double Noise2(double x, double y)\n        {\n\n            // Get points for A2* lattice\n            double s = 0.366025403784439 * (x + y);\n            double xs = x + s, ys = y + s;\n\n            return noise2_Base(xs, ys);\n        }\n\n        /**\n         * 2D SuperSimplex noise, with Y pointing down the main diagonal.\n         * Might be better for a 2D sandbox style game, where Y is vertical.\n         * Probably slightly less optimal for heightmaps or continent maps.\n         */\n        public double Noise2_XBeforeY(double x, double y)\n        {\n\n            // Skew transform and rotation baked into one.\n            double xx = x * 0.7071067811865476;\n            double yy = y * 1.224744871380249;\n\n            return noise2_Base(yy + xx, yy - xx);\n        }\n\n        /**\n         * 2D SuperSimplex noise base.\n         * Lookup table implementation inspired by DigitalShadow.\n         */\n        private double noise2_Base(double xs, double ys)\n        {\n            double value = 0;\n\n            // Get base points and offsets\n            int xsb = fastFloor(xs), ysb = fastFloor(ys);\n            double xsi = xs - xsb, ysi = ys - ysb;\n\n            // Index to point list\n            int a = (int)(xsi + ysi);\n            int index =\n                (a << 2) |\n                (int)(xsi - ysi / 2 + 1 - a / 2.0) << 3 |\n                (int)(ysi - xsi / 2 + 1 - a / 2.0) << 4;\n\n            double ssi = (xsi + ysi) * -0.211324865405187;\n            double xi = xsi + ssi, yi = ysi + ssi;\n\n            // Point contributions\n            for (int i = 0; i < 4; i++)\n            {\n                LatticePoint2D c = LOOKUP_2D[index + i];\n\n                double dx = xi + c.dx, dy = yi + c.dy;\n                double attn = 2.0 / 3.0 - dx * dx - dy * dy;\n                if (attn <= 0) continue;\n\n                int pxm = (xsb + c.xsv) & PMASK, pym = (ysb + c.ysv) & PMASK;\n                Grad2 grad = permGrad2[perm[pxm] ^ pym];\n                double extrapolation = grad.dx * dx + grad.dy * dy;\n\n                attn *= attn;\n                value += attn * attn * extrapolation;\n            }\n\n            return value;\n        }\n\n        /**\n         * 3D Re-oriented 8-point BCC noise, classic orientation\n         * Proper substitute for what 3D SuperSimplex \"should\" be,\n         * in light of Forbidden Formulae.\n         * Use noise3_XYBeforeZ or noise3_XZBeforeY instead, wherever appropriate.\n         */\n        public double Noise3_Classic(double x, double y, double z)\n        {\n\n            // Re-orient the cubic lattices via rotation, to produce the expected look on cardinal planar slices.\n            // If texturing objects that don't tend to have cardinal plane faces, you could even remove this.\n            // Orthonormal rotation. Not a skew transform.\n            double r = (2.0 / 3.0) * (x + y + z);\n            double xr = r - x, yr = r - y, zr = r - z;\n\n            // Evaluate both lattices to form a BCC lattice.\n            return noise3_BCC(xr, yr, zr);\n        }\n\n        /**\n         * 3D Re-oriented 8-point BCC noise, with better visual isotropy in (X, Y).\n         * Recommended for 3D terrain and time-varied animations.\n         * The Z coordinate should always be the \"different\" coordinate in your use case.\n         * If Y is vertical in world coordinates, call noise3_XYBeforeZ(x, z, Y) or use noise3_XZBeforeY.\n         * If Z is vertical in world coordinates, call noise3_XYBeforeZ(x, y, Z).\n         * For a time varied animation, call noise3_XYBeforeZ(x, y, T).\n         */\n        public double Noise3_XYBeforeZ(double x, double y, double z)\n        {\n\n            // Re-orient the cubic lattices without skewing, to make X and Y triangular like 2D.\n            // Orthonormal rotation. Not a skew transform.\n            double xy = x + y;\n            double s2 = xy * -0.211324865405187;\n            double zz = z * 0.577350269189626;\n            double xr = x + s2 - zz, yr = y + s2 - zz;\n            double zr = xy * 0.577350269189626 + zz;\n\n            // Evaluate both lattices to form a BCC lattice.\n            return noise3_BCC(xr, yr, zr);\n        }\n\n        /**\n         * 3D Re-oriented 8-point BCC noise, with better visual isotropy in (X, Z).\n         * Recommended for 3D terrain and time-varied animations.\n         * The Y coordinate should always be the \"different\" coordinate in your use case.\n         * If Y is vertical in world coordinates, call noise3_XZBeforeY(x, Y, z).\n         * If Z is vertical in world coordinates, call noise3_XZBeforeY(x, Z, y) or use noise3_XYBeforeZ.\n         * For a time varied animation, call noise3_XZBeforeY(x, T, y) or use noise3_XYBeforeZ.\n         */\n        public double Noise3_XZBeforeY(double x, double y, double z)\n        {\n\n            // Re-orient the cubic lattices without skewing, to make X and Z triangular like 2D.\n            // Orthonormal rotation. Not a skew transform.\n            double xz = x + z;\n            double s2 = xz * -0.211324865405187;\n            double yy = y * 0.577350269189626;\n            double xr = x + s2 - yy; double zr = z + s2 - yy;\n            double yr = xz * 0.577350269189626 + yy;\n\n            // Evaluate both lattices to form a BCC lattice.\n            return noise3_BCC(xr, yr, zr);\n        }\n\n        /**\n         * Generate overlapping cubic lattices for 3D Re-oriented BCC noise.\n         * Lookup table implementation inspired by DigitalShadow.\n         * It was actually faster to narrow down the points in the loop itself,\n         * than to build up the index with enough info to isolate 8 points.\n         */\n        private double noise3_BCC(double xr, double yr, double zr)\n        {\n\n            // Get base and offsets inside cube of first lattice.\n            int xrb = fastFloor(xr), yrb = fastFloor(yr), zrb = fastFloor(zr);\n            double xri = xr - xrb, yri = yr - yrb, zri = zr - zrb;\n\n            // Identify which octant of the cube we're in. This determines which cell\n            // in the other cubic lattice we're in, and also narrows down one point on each.\n            int xht = (int)(xri + 0.5), yht = (int)(yri + 0.5), zht = (int)(zri + 0.5);\n            int index = (xht << 0) | (yht << 1) | (zht << 2);\n\n            // Point contributions\n            double value = 0;\n            LatticePoint3D c = LOOKUP_3D[index];\n            while (c != null)\n            {\n                double dxr = xri + c.dxr, dyr = yri + c.dyr, dzr = zri + c.dzr;\n                double attn = 0.75 - dxr * dxr - dyr * dyr - dzr * dzr;\n                if (attn < 0)\n                {\n                    c = c.NextOnFailure;\n                }\n                else\n                {\n                    int pxm = (xrb + c.xrv) & PMASK, pym = (yrb + c.yrv) & PMASK, pzm = (zrb + c.zrv) & PMASK;\n                    Grad3 grad = permGrad3[perm[perm[pxm] ^ pym] ^ pzm];\n                    double extrapolation = grad.dx * dxr + grad.dy * dyr + grad.dz * dzr;\n\n                    attn *= attn;\n                    value += attn * attn * extrapolation;\n                    c = c.NextOnSuccess;\n                }\n            }\n            return value;\n        }\n\n        /**\n\t\t * 4D SuperSimplex noise, classic lattice orientation.\n\t\t */\n        public double Noise4_Classic(double x, double y, double z, double w)\n        {\n\n            // Get points for A4 lattice\n            double s = 0.309016994374947 * (x + y + z + w);\n            double xs = x + s, ys = y + s, zs = z + s, ws = w + s;\n\n            return noise4_Base(xs, ys, zs, ws);\n        }\n\n        /**\n\t\t * 4D SuperSimplex noise, with XY and ZW forming orthogonal triangular-based planes.\n\t\t * Recommended for 3D terrain, where X and Y (or Z and W) are horizontal.\n\t\t * Recommended for noise(x, y, sin(time), cos(time)) trick.\n\t\t */\n        public double Noise4_XYBeforeZW(double x, double y, double z, double w)\n        {\n\n            double s2 = (x + y) * -0.28522513987434876941 + (z + w) * 0.83897065470611435718;\n            double t2 = (z + w) * 0.21939749883706435719 + (x + y) * -0.48214856493302476942;\n            double xs = x + s2, ys = y + s2, zs = z + t2, ws = w + t2;\n\n            return noise4_Base(xs, ys, zs, ws);\n        }\n\n        /**\n\t\t * 4D SuperSimplex noise, with XZ and YW forming orthogonal triangular-based planes.\n\t\t * Recommended for 3D terrain, where X and Z (or Y and W) are horizontal.\n\t\t */\n        public double Noise4_XZBeforeYW(double x, double y, double z, double w)\n        {\n\n            double s2 = (x + z) * -0.28522513987434876941 + (y + w) * 0.83897065470611435718;\n            double t2 = (y + w) * 0.21939749883706435719 + (x + z) * -0.48214856493302476942;\n            double xs = x + s2, ys = y + t2, zs = z + s2, ws = w + t2;\n\n            return noise4_Base(xs, ys, zs, ws);\n        }\n\n        /**\n\t\t * 4D SuperSimplex noise, with XYZ oriented like noise3_Classic,\n\t\t * and W for an extra degree of freedom.\n\t\t * Recommended for time-varied animations which texture a 3D object (W=time)\n\t\t */\n        public double Noise4_XYZBeforeW(double x, double y, double z, double w)\n        {\n\n            double xyz = x + y + z;\n            double ww = w * 1.118033988749894;\n            double s2 = xyz * -0.16666666666666666 + ww;\n            double xs = x + s2, ys = y + s2, zs = z + s2, ws = -0.5 * xyz + ww;\n\n            return noise4_Base(xs, ys, zs, ws);\n        }\n\n        /**\n\t\t * 4D SuperSimplex noise base.\n\t\t * Using ultra-simple 4x4x4x4 lookup partitioning.\n\t\t * This isn't as elegant or SIMD/GPU/etc. portable as other approaches,\n\t\t * but it does compete performance-wise with optimized OpenSimplex1.\n\t\t */\n        private double noise4_Base(double xs, double ys, double zs, double ws)\n        {\n            double value = 0;\n\n            // Get base points and offsets\n            int xsb = fastFloor(xs), ysb = fastFloor(ys), zsb = fastFloor(zs), wsb = fastFloor(ws);\n            double xsi = xs - xsb, ysi = ys - ysb, zsi = zs - zsb, wsi = ws - wsb;\n\n            // Unskewed offsets\n            double ssi = (xsi + ysi + zsi + wsi) * -0.138196601125011;\n            double xi = xsi + ssi, yi = ysi + ssi, zi = zsi + ssi, wi = wsi + ssi;\n\n            int index = ((fastFloor(xs * 4) & 3) << 0)\n                | ((fastFloor(ys * 4) & 3) << 2)\n                | ((fastFloor(zs * 4) & 3) << 4)\n                | ((fastFloor(ws * 4) & 3) << 6);\n\n            // Point contributions\n            foreach (LatticePoint4D c in LOOKUP_4D[index])\n            {\n                double dx = xi + c.dx, dy = yi + c.dy, dz = zi + c.dz, dw = wi + c.dw;\n                double attn = 0.8 - dx * dx - dy * dy - dz * dz - dw * dw;\n                if (attn > 0)\n                {\n                    attn *= attn;\n\n                    int pxm = (xsb + c.xsv) & PMASK, pym = (ysb + c.ysv) & PMASK;\n                    int pzm = (zsb + c.zsv) & PMASK, pwm = (wsb + c.wsv) & PMASK;\n                    Grad4 grad = permGrad4[perm[perm[perm[pxm] ^ pym] ^ pzm] ^ pwm];\n                    double extrapolation = grad.dx * dx + grad.dy * dy + grad.dz * dz + grad.dw * dw;\n\n                    value += attn * attn * extrapolation;\n                }\n            }\n            return value;\n        }\n\n        /*\n         * Utility\n         */\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        private static int fastFloor(double x)\n        {\n            int xi = (int)x;\n            return x < xi ? xi - 1 : xi;\n        }\n\n        /*\n         * Lookup Tables & Gradients\n         */\n\n        private static LatticePoint2D[] LOOKUP_2D;\n        private static LatticePoint3D[] LOOKUP_3D;\n        private static LatticePoint4D[][] LOOKUP_4D;\n\n        private const double N2 = 0.05481866495625118;\n        private const double N3 = 0.2781926117527186;\n        private const double N4 = 0.11127401889945551;\n        private static Grad2[] GRADIENTS_2D;\n        private static Grad3[] GRADIENTS_3D;\n        private static Grad4[] GRADIENTS_4D;\n\n        static OpenSimplex2S()\n        {\n            LOOKUP_2D = new LatticePoint2D[8 * 4];\n            LOOKUP_3D = new LatticePoint3D[8];\n            LOOKUP_4D = new LatticePoint4D[256][];\n\n            for (int i = 0; i < 8; i++)\n            {\n                int i1, j1, i2, j2;\n                if ((i & 1) == 0)\n                {\n                    if ((i & 2) == 0) { i1 = -1; j1 = 0; } else { i1 = 1; j1 = 0; }\n                    if ((i & 4) == 0) { i2 = 0; j2 = -1; } else { i2 = 0; j2 = 1; }\n                }\n                else\n                {\n                    if ((i & 2) != 0) { i1 = 2; j1 = 1; } else { i1 = 0; j1 = 1; }\n                    if ((i & 4) != 0) { i2 = 1; j2 = 2; } else { i2 = 1; j2 = 0; }\n                }\n                LOOKUP_2D[i * 4 + 0] = new LatticePoint2D(0, 0);\n                LOOKUP_2D[i * 4 + 1] = new LatticePoint2D(1, 1);\n                LOOKUP_2D[i * 4 + 2] = new LatticePoint2D(i1, j1);\n                LOOKUP_2D[i * 4 + 3] = new LatticePoint2D(i2, j2);\n            }\n\n            for (int i = 0; i < 8; i++)\n            {\n                int i1, j1, k1, i2, j2, k2;\n                i1 = (i >> 0) & 1; j1 = (i >> 1) & 1; k1 = (i >> 2) & 1;\n                i2 = i1 ^ 1; j2 = j1 ^ 1; k2 = k1 ^ 1;\n\n                // The two points within this octant, one from each of the two cubic half-lattices.\n                LatticePoint3D c0 = new LatticePoint3D(i1, j1, k1, 0);\n                LatticePoint3D c1 = new LatticePoint3D(i1 + i2, j1 + j2, k1 + k2, 1);\n\n                // (1, 0, 0) vs (0, 1, 1) away from octant.\n                LatticePoint3D c2 = new LatticePoint3D(i1 ^ 1, j1, k1, 0);\n                LatticePoint3D c3 = new LatticePoint3D(i1, j1 ^ 1, k1 ^ 1, 0);\n\n                // (1, 0, 0) vs (0, 1, 1) away from octant, on second half-lattice.\n                LatticePoint3D c4 = new LatticePoint3D(i1 + (i2 ^ 1), j1 + j2, k1 + k2, 1);\n                LatticePoint3D c5 = new LatticePoint3D(i1 + i2, j1 + (j2 ^ 1), k1 + (k2 ^ 1), 1);\n\n                // (0, 1, 0) vs (1, 0, 1) away from octant.\n                LatticePoint3D c6 = new LatticePoint3D(i1, j1 ^ 1, k1, 0);\n                LatticePoint3D c7 = new LatticePoint3D(i1 ^ 1, j1, k1 ^ 1, 0);\n\n                // (0, 1, 0) vs (1, 0, 1) away from octant, on second half-lattice.\n                LatticePoint3D c8 = new LatticePoint3D(i1 + i2, j1 + (j2 ^ 1), k1 + k2, 1);\n                LatticePoint3D c9 = new LatticePoint3D(i1 + (i2 ^ 1), j1 + j2, k1 + (k2 ^ 1), 1);\n\n                // (0, 0, 1) vs (1, 1, 0) away from octant.\n                LatticePoint3D cA = new LatticePoint3D(i1, j1, k1 ^ 1, 0);\n                LatticePoint3D cB = new LatticePoint3D(i1 ^ 1, j1 ^ 1, k1, 0);\n\n                // (0, 0, 1) vs (1, 1, 0) away from octant, on second half-lattice.\n                LatticePoint3D cC = new LatticePoint3D(i1 + i2, j1 + j2, k1 + (k2 ^ 1), 1);\n                LatticePoint3D cD = new LatticePoint3D(i1 + (i2 ^ 1), j1 + (j2 ^ 1), k1 + k2, 1);\n\n                // First two points are guaranteed.\n                c0.NextOnFailure = c0.NextOnSuccess = c1;\n                c1.NextOnFailure = c1.NextOnSuccess = c2;\n\n                // If c2 is in range, then we know c3 and c4 are not.\n                c2.NextOnFailure = c3; c2.NextOnSuccess = c5;\n                c3.NextOnFailure = c4; c3.NextOnSuccess = c4;\n\n                // If c4 is in range, then we know c5 is not.\n                c4.NextOnFailure = c5; c4.NextOnSuccess = c6;\n                c5.NextOnFailure = c5.NextOnSuccess = c6;\n\n                // If c6 is in range, then we know c7 and c8 are not.\n                c6.NextOnFailure = c7; c6.NextOnSuccess = c9;\n                c7.NextOnFailure = c8; c7.NextOnSuccess = c8;\n\n                // If c8 is in range, then we know c9 is not.\n                c8.NextOnFailure = c9; c8.NextOnSuccess = cA;\n                c9.NextOnFailure = c9.NextOnSuccess = cA;\n\n                // If cA is in range, then we know cB and cC are not.\n                cA.NextOnFailure = cB; cA.NextOnSuccess = cD;\n                cB.NextOnFailure = cC; cB.NextOnSuccess = cC;\n\n                // If cC is in range, then we know cD is not.\n                cC.NextOnFailure = cD; cC.NextOnSuccess = null;\n                cD.NextOnFailure = cD.NextOnSuccess = null;\n\n                LOOKUP_3D[i] = c0;\n            }\n\n            int[][] lookup4DPregen = {\n                new int[] { 0x15, 0x45, 0x51, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x15, 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xAA },\n                new int[] { 0x01, 0x05, 0x11, 0x15, 0x41, 0x45, 0x51, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA },\n                new int[] { 0x01, 0x15, 0x16, 0x45, 0x46, 0x51, 0x52, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x15, 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA9, 0xAA },\n                new int[] { 0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xAA },\n                new int[] { 0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xAA },\n                new int[] { 0x05, 0x15, 0x16, 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xAA, 0xAB },\n                new int[] { 0x04, 0x05, 0x14, 0x15, 0x44, 0x45, 0x54, 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA },\n                new int[] { 0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xAA },\n                new int[] { 0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x9A, 0xAA },\n                new int[] { 0x05, 0x15, 0x16, 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x5B, 0x6A, 0x9A, 0xAA, 0xAB },\n                new int[] { 0x04, 0x15, 0x19, 0x45, 0x49, 0x54, 0x55, 0x58, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x05, 0x15, 0x19, 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xAA, 0xAE },\n                new int[] { 0x05, 0x15, 0x19, 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x5E, 0x6A, 0x9A, 0xAA, 0xAE },\n                new int[] { 0x05, 0x15, 0x1A, 0x45, 0x4A, 0x55, 0x56, 0x59, 0x5A, 0x5B, 0x5E, 0x6A, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n                new int[] { 0x15, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x11, 0x15, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xAA },\n                new int[] { 0x11, 0x15, 0x51, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x96, 0xA6, 0xAA },\n                new int[] { 0x11, 0x15, 0x16, 0x51, 0x52, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x96, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x14, 0x15, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA9, 0xAA },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x9A, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x15, 0x16, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x6B, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x14, 0x15, 0x54, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x99, 0xA9, 0xAA },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x9A, 0xAA },\n                new int[] { 0x15, 0x16, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x6B, 0x9A, 0xAA, 0xAB },\n                new int[] { 0x14, 0x15, 0x19, 0x54, 0x55, 0x58, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x99, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x15, 0x19, 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x6E, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x15, 0x19, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x6E, 0x9A, 0xAA, 0xAE },\n                new int[] { 0x15, 0x1A, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x6B, 0x6E, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n                new int[] { 0x10, 0x11, 0x14, 0x15, 0x50, 0x51, 0x54, 0x55, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x11, 0x15, 0x51, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xAA },\n                new int[] { 0x11, 0x15, 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0xA6, 0xAA },\n                new int[] { 0x11, 0x15, 0x16, 0x51, 0x52, 0x55, 0x56, 0x65, 0x66, 0x67, 0x6A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x14, 0x15, 0x54, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA9, 0xAA },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA6, 0xAA },\n                new int[] { 0x15, 0x16, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x6B, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x14, 0x15, 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0xA9, 0xAA },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA9, 0xAA },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xAA },\n                new int[] { 0x15, 0x16, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6B, 0xAA, 0xAB },\n                new int[] { 0x14, 0x15, 0x19, 0x54, 0x55, 0x58, 0x59, 0x65, 0x69, 0x6A, 0x6D, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x15, 0x19, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x6E, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x15, 0x19, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6E, 0xAA, 0xAE },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x69, 0x6A, 0x6B, 0x6E, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n                new int[] { 0x10, 0x15, 0x25, 0x51, 0x54, 0x55, 0x61, 0x64, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x11, 0x15, 0x25, 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xAA, 0xBA },\n                new int[] { 0x11, 0x15, 0x25, 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x6A, 0x76, 0xA6, 0xAA, 0xBA },\n                new int[] { 0x11, 0x15, 0x26, 0x51, 0x55, 0x56, 0x62, 0x65, 0x66, 0x67, 0x6A, 0x76, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n                new int[] { 0x14, 0x15, 0x25, 0x54, 0x55, 0x59, 0x64, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x15, 0x25, 0x55, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x15, 0x25, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xA6, 0xAA, 0xBA },\n                new int[] { 0x15, 0x26, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x6B, 0x7A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n                new int[] { 0x14, 0x15, 0x25, 0x54, 0x55, 0x59, 0x64, 0x65, 0x69, 0x6A, 0x79, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x15, 0x25, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x15, 0x25, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xAA, 0xBA },\n                new int[] { 0x15, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6B, 0x7A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n                new int[] { 0x14, 0x15, 0x29, 0x54, 0x55, 0x59, 0x65, 0x68, 0x69, 0x6A, 0x6D, 0x79, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n                new int[] { 0x15, 0x29, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x6E, 0x7A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n                new int[] { 0x15, 0x55, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6E, 0x7A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6B, 0x6E, 0x7A, 0xAA, 0xAB, 0xAE, 0xBA, 0xBF },\n                new int[] { 0x45, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xAA },\n                new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x5A, 0x66, 0x95, 0x96, 0x9A, 0xA6, 0xAA },\n                new int[] { 0x41, 0x45, 0x46, 0x51, 0x52, 0x55, 0x56, 0x5A, 0x66, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x44, 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA9, 0xAA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x45, 0x46, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x44, 0x45, 0x54, 0x55, 0x59, 0x5A, 0x69, 0x95, 0x99, 0x9A, 0xA9, 0xAA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xAA },\n                new int[] { 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x96, 0x9A, 0x9B, 0xAA, 0xAB },\n                new int[] { 0x44, 0x45, 0x49, 0x54, 0x55, 0x58, 0x59, 0x5A, 0x69, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x45, 0x49, 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x99, 0x9A, 0x9E, 0xAA, 0xAE },\n                new int[] { 0x45, 0x4A, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x9A, 0x9B, 0x9E, 0xAA, 0xAB, 0xAE, 0xAF },\n                new int[] { 0x50, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x95, 0x96, 0x99, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x51, 0x55, 0x56, 0x59, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x51, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x51, 0x52, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xA7, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x56, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x15, 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x15, 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x58, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAD, 0xAE },\n                new int[] { 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n                new int[] { 0x50, 0x51, 0x54, 0x55, 0x65, 0x66, 0x69, 0x95, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xAA },\n                new int[] { 0x51, 0x52, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x96, 0xA6, 0xA7, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x15, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x15, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xBA },\n                new int[] { 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA9, 0xAA },\n                new int[] { 0x15, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xBA },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x9A, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x58, 0x59, 0x65, 0x69, 0x6A, 0x99, 0xA9, 0xAA, 0xAD, 0xAE },\n                new int[] { 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x69, 0x6A, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n                new int[] { 0x50, 0x51, 0x54, 0x55, 0x61, 0x64, 0x65, 0x66, 0x69, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x51, 0x55, 0x61, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA },\n                new int[] { 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x6A, 0xA5, 0xA6, 0xAA, 0xB6, 0xBA },\n                new int[] { 0x51, 0x55, 0x56, 0x62, 0x65, 0x66, 0x6A, 0xA6, 0xA7, 0xAA, 0xAB, 0xB6, 0xBA, 0xBB },\n                new int[] { 0x54, 0x55, 0x64, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA },\n                new int[] { 0x55, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x55, 0x56, 0x65, 0x66, 0x6A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n                new int[] { 0x54, 0x55, 0x59, 0x64, 0x65, 0x69, 0x6A, 0xA5, 0xA9, 0xAA, 0xB9, 0xBA },\n                new int[] { 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x15, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x68, 0x69, 0x6A, 0xA9, 0xAA, 0xAD, 0xAE, 0xB9, 0xBA, 0xBE },\n                new int[] { 0x55, 0x59, 0x65, 0x69, 0x6A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n                new int[] { 0x15, 0x55, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xAA, 0xAB, 0xAE, 0xBA, 0xBF },\n                new int[] { 0x40, 0x41, 0x44, 0x45, 0x50, 0x51, 0x54, 0x55, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xAA },\n                new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x95, 0x96, 0x9A, 0xA6, 0xAA },\n                new int[] { 0x41, 0x45, 0x46, 0x51, 0x52, 0x55, 0x56, 0x95, 0x96, 0x97, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x44, 0x45, 0x54, 0x55, 0x59, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA9, 0xAA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA },\n                new int[] { 0x45, 0x46, 0x55, 0x56, 0x5A, 0x95, 0x96, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x44, 0x45, 0x54, 0x55, 0x59, 0x95, 0x99, 0x9A, 0xA9, 0xAA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xAA },\n                new int[] { 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9B, 0xAA, 0xAB },\n                new int[] { 0x44, 0x45, 0x49, 0x54, 0x55, 0x58, 0x59, 0x95, 0x99, 0x9A, 0x9D, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x45, 0x49, 0x55, 0x59, 0x5A, 0x95, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9E, 0xAA, 0xAE },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x96, 0x99, 0x9A, 0x9B, 0x9E, 0xAA, 0xAB, 0xAE, 0xAF },\n                new int[] { 0x50, 0x51, 0x54, 0x55, 0x65, 0x95, 0x96, 0x99, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA },\n                new int[] { 0x51, 0x52, 0x55, 0x56, 0x66, 0x95, 0x96, 0x9A, 0xA6, 0xA7, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x45, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xEA },\n                new int[] { 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA },\n                new int[] { 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xEA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x58, 0x59, 0x69, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAD, 0xAE },\n                new int[] { 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x96, 0x99, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n                new int[] { 0x50, 0x51, 0x54, 0x55, 0x65, 0x95, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xAA },\n                new int[] { 0x51, 0x52, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x51, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x58, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE },\n                new int[] { 0x54, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x66, 0x69, 0x6A, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xAF },\n                new int[] { 0x50, 0x51, 0x54, 0x55, 0x61, 0x64, 0x65, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xB5, 0xBA },\n                new int[] { 0x51, 0x55, 0x61, 0x65, 0x66, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA },\n                new int[] { 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0xB6, 0xBA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x96, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB, 0xB6, 0xBA, 0xBB },\n                new int[] { 0x54, 0x55, 0x64, 0x65, 0x69, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA },\n                new int[] { 0x55, 0x65, 0x66, 0x69, 0x6A, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x96, 0xA5, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n                new int[] { 0x54, 0x55, 0x59, 0x64, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xB9, 0xBA },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x55, 0x56, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xBA, 0xBB },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x99, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE, 0xB9, 0xBA, 0xBE },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x99, 0xA5, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n                new int[] { 0x55, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xBA },\n                new int[] { 0x40, 0x45, 0x51, 0x54, 0x55, 0x85, 0x91, 0x94, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x85, 0x91, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xAA, 0xEA },\n                new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x85, 0x91, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xD6, 0xEA },\n                new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x86, 0x92, 0x95, 0x96, 0x97, 0x9A, 0xA6, 0xAA, 0xAB, 0xD6, 0xEA, 0xEB },\n                new int[] { 0x44, 0x45, 0x54, 0x55, 0x59, 0x85, 0x94, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x45, 0x55, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xDA, 0xEA },\n                new int[] { 0x45, 0x55, 0x56, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xDA, 0xEA },\n                new int[] { 0x45, 0x55, 0x56, 0x86, 0x95, 0x96, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB, 0xDA, 0xEA, 0xEB },\n                new int[] { 0x44, 0x45, 0x54, 0x55, 0x59, 0x85, 0x94, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xD9, 0xEA },\n                new int[] { 0x45, 0x55, 0x59, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xDA, 0xEA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xAA, 0xDA, 0xEA },\n                new int[] { 0x45, 0x55, 0x56, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB, 0xDA, 0xEA, 0xEB },\n                new int[] { 0x44, 0x45, 0x54, 0x55, 0x59, 0x89, 0x95, 0x98, 0x99, 0x9A, 0x9D, 0xA9, 0xAA, 0xAE, 0xD9, 0xEA, 0xEE },\n                new int[] { 0x45, 0x55, 0x59, 0x89, 0x95, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE, 0xDA, 0xEA, 0xEE },\n                new int[] { 0x45, 0x55, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE, 0xDA, 0xEA, 0xEE },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9B, 0x9E, 0xAA, 0xAB, 0xAE, 0xDA, 0xEA, 0xEF },\n                new int[] { 0x50, 0x51, 0x54, 0x55, 0x65, 0x91, 0x94, 0x95, 0x96, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x51, 0x55, 0x91, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xE6, 0xEA },\n                new int[] { 0x51, 0x55, 0x56, 0x91, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xE6, 0xEA },\n                new int[] { 0x51, 0x55, 0x56, 0x92, 0x95, 0x96, 0x9A, 0xA6, 0xA7, 0xAA, 0xAB, 0xE6, 0xEA, 0xEB },\n                new int[] { 0x54, 0x55, 0x94, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xE9, 0xEA },\n                new int[] { 0x55, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x55, 0x56, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x55, 0x56, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB, 0xEA, 0xEB },\n                new int[] { 0x54, 0x55, 0x59, 0x94, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xE9, 0xEA },\n                new int[] { 0x55, 0x59, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x45, 0x55, 0x56, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xAB, 0xEA, 0xEB },\n                new int[] { 0x54, 0x55, 0x59, 0x95, 0x98, 0x99, 0x9A, 0xA9, 0xAA, 0xAD, 0xAE, 0xE9, 0xEA, 0xEE },\n                new int[] { 0x55, 0x59, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE },\n                new int[] { 0x45, 0x55, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xAA, 0xAB, 0xAE, 0xEA, 0xEF },\n                new int[] { 0x50, 0x51, 0x54, 0x55, 0x65, 0x91, 0x94, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xE5, 0xEA },\n                new int[] { 0x51, 0x55, 0x65, 0x91, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xE6, 0xEA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x91, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0xE6, 0xEA },\n                new int[] { 0x51, 0x55, 0x56, 0x66, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB, 0xE6, 0xEA, 0xEB },\n                new int[] { 0x54, 0x55, 0x65, 0x94, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xE9, 0xEA },\n                new int[] { 0x55, 0x65, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x51, 0x55, 0x56, 0x66, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xAB, 0xEA, 0xEB },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x94, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xE9, 0xEA },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x55, 0x56, 0x59, 0x65, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xEA, 0xEB },\n                new int[] { 0x54, 0x55, 0x59, 0x69, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE, 0xE9, 0xEA, 0xEE },\n                new int[] { 0x54, 0x55, 0x59, 0x69, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE },\n                new int[] { 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xEA },\n                new int[] { 0x50, 0x51, 0x54, 0x55, 0x65, 0x95, 0xA1, 0xA4, 0xA5, 0xA6, 0xA9, 0xAA, 0xB5, 0xBA, 0xE5, 0xEA, 0xFA },\n                new int[] { 0x51, 0x55, 0x65, 0x95, 0xA1, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA, 0xE6, 0xEA, 0xFA },\n                new int[] { 0x51, 0x55, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA, 0xE6, 0xEA, 0xFA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB, 0xB6, 0xBA, 0xE6, 0xEA, 0xFB },\n                new int[] { 0x54, 0x55, 0x65, 0x95, 0xA4, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA, 0xE9, 0xEA, 0xFA },\n                new int[] { 0x55, 0x65, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA },\n                new int[] { 0x51, 0x55, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA },\n                new int[] { 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0xAB, 0xBA, 0xEA, 0xFB },\n                new int[] { 0x54, 0x55, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA, 0xE9, 0xEA, 0xFA },\n                new int[] { 0x54, 0x55, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA },\n                new int[] { 0x55, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA },\n                new int[] { 0x55, 0x56, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xBA, 0xEA },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE, 0xB9, 0xBA, 0xE9, 0xEA, 0xFE },\n                new int[] { 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xAE, 0xBA, 0xEA, 0xFE },\n                new int[] { 0x55, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xBA, 0xEA },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xBA, 0xEA },\n            };\n            LatticePoint4D[] latticePoints = new LatticePoint4D[256];\n            for (int i = 0; i < 256; i++)\n            {\n                int cx = ((i >> 0) & 3) - 1;\n                int cy = ((i >> 2) & 3) - 1;\n                int cz = ((i >> 4) & 3) - 1;\n                int cw = ((i >> 6) & 3) - 1;\n                latticePoints[i] = new LatticePoint4D(cx, cy, cz, cw);\n            }\n            for (int i = 0; i < 256; i++)\n            {\n                LOOKUP_4D[i] = new LatticePoint4D[lookup4DPregen[i].Length];\n                for (int j = 0; j < lookup4DPregen[i].Length; j++)\n                {\n                    LOOKUP_4D[i][j] = latticePoints[lookup4DPregen[i][j]];\n                }\n            }\n\n            GRADIENTS_2D = new Grad2[PSIZE];\n            Grad2[] grad2 = {\n                new Grad2( 0.130526192220052,  0.99144486137381),\n                new Grad2( 0.38268343236509,   0.923879532511287),\n                new Grad2( 0.608761429008721,  0.793353340291235),\n                new Grad2( 0.793353340291235,  0.608761429008721),\n                new Grad2( 0.923879532511287,  0.38268343236509),\n                new Grad2( 0.99144486137381,   0.130526192220051),\n                new Grad2( 0.99144486137381,  -0.130526192220051),\n                new Grad2( 0.923879532511287, -0.38268343236509),\n                new Grad2( 0.793353340291235, -0.60876142900872),\n                new Grad2( 0.608761429008721, -0.793353340291235),\n                new Grad2( 0.38268343236509,  -0.923879532511287),\n                new Grad2( 0.130526192220052, -0.99144486137381),\n                new Grad2(-0.130526192220052, -0.99144486137381),\n                new Grad2(-0.38268343236509,  -0.923879532511287),\n                new Grad2(-0.608761429008721, -0.793353340291235),\n                new Grad2(-0.793353340291235, -0.608761429008721),\n                new Grad2(-0.923879532511287, -0.38268343236509),\n                new Grad2(-0.99144486137381,  -0.130526192220052),\n                new Grad2(-0.99144486137381,   0.130526192220051),\n                new Grad2(-0.923879532511287,  0.38268343236509),\n                new Grad2(-0.793353340291235,  0.608761429008721),\n                new Grad2(-0.608761429008721,  0.793353340291235),\n                new Grad2(-0.38268343236509,   0.923879532511287),\n                new Grad2(-0.130526192220052,  0.99144486137381)\n            };\n            for (int i = 0; i < grad2.Length; i++)\n            {\n                grad2[i].dx /= N2; grad2[i].dy /= N2;\n            }\n            for (int i = 0; i < PSIZE; i++)\n            {\n                GRADIENTS_2D[i] = grad2[i % grad2.Length];\n            }\n\n            GRADIENTS_3D = new Grad3[PSIZE];\n            Grad3[] grad3 = {\n                new Grad3(-2.22474487139,      -2.22474487139,      -1.0),\n                new Grad3(-2.22474487139,      -2.22474487139,       1.0),\n                new Grad3(-3.0862664687972017, -1.1721513422464978,  0.0),\n                new Grad3(-1.1721513422464978, -3.0862664687972017,  0.0),\n                new Grad3(-2.22474487139,      -1.0,                -2.22474487139),\n                new Grad3(-2.22474487139,       1.0,                -2.22474487139),\n                new Grad3(-1.1721513422464978,  0.0,                -3.0862664687972017),\n                new Grad3(-3.0862664687972017,  0.0,                -1.1721513422464978),\n                new Grad3(-2.22474487139,      -1.0,                 2.22474487139),\n                new Grad3(-2.22474487139,       1.0,                 2.22474487139),\n                new Grad3(-3.0862664687972017,  0.0,                 1.1721513422464978),\n                new Grad3(-1.1721513422464978,  0.0,                 3.0862664687972017),\n                new Grad3(-2.22474487139,       2.22474487139,      -1.0),\n                new Grad3(-2.22474487139,       2.22474487139,       1.0),\n                new Grad3(-1.1721513422464978,  3.0862664687972017,  0.0),\n                new Grad3(-3.0862664687972017,  1.1721513422464978,  0.0),\n                new Grad3(-1.0,                -2.22474487139,      -2.22474487139),\n                new Grad3( 1.0,                -2.22474487139,      -2.22474487139),\n                new Grad3( 0.0,                -3.0862664687972017, -1.1721513422464978),\n                new Grad3( 0.0,                -1.1721513422464978, -3.0862664687972017),\n                new Grad3(-1.0,                -2.22474487139,       2.22474487139),\n                new Grad3( 1.0,                -2.22474487139,       2.22474487139),\n                new Grad3( 0.0,                -1.1721513422464978,  3.0862664687972017),\n                new Grad3( 0.0,                -3.0862664687972017,  1.1721513422464978),\n                new Grad3(-1.0,                 2.22474487139,      -2.22474487139),\n                new Grad3( 1.0,                 2.22474487139,      -2.22474487139),\n                new Grad3( 0.0,                 1.1721513422464978, -3.0862664687972017),\n                new Grad3( 0.0,                 3.0862664687972017, -1.1721513422464978),\n                new Grad3(-1.0,                 2.22474487139,       2.22474487139),\n                new Grad3( 1.0,                 2.22474487139,       2.22474487139),\n                new Grad3( 0.0,                 3.0862664687972017,  1.1721513422464978),\n                new Grad3( 0.0,                 1.1721513422464978,  3.0862664687972017),\n                new Grad3( 2.22474487139,      -2.22474487139,      -1.0),\n                new Grad3( 2.22474487139,      -2.22474487139,       1.0),\n                new Grad3( 1.1721513422464978, -3.0862664687972017,  0.0),\n                new Grad3( 3.0862664687972017, -1.1721513422464978,  0.0),\n                new Grad3( 2.22474487139,      -1.0,                -2.22474487139),\n                new Grad3( 2.22474487139,       1.0,                -2.22474487139),\n                new Grad3( 3.0862664687972017,  0.0,                -1.1721513422464978),\n                new Grad3( 1.1721513422464978,  0.0,                -3.0862664687972017),\n                new Grad3( 2.22474487139,      -1.0,                 2.22474487139),\n                new Grad3( 2.22474487139,       1.0,                 2.22474487139),\n                new Grad3( 1.1721513422464978,  0.0,                 3.0862664687972017),\n                new Grad3( 3.0862664687972017,  0.0,                 1.1721513422464978),\n                new Grad3( 2.22474487139,       2.22474487139,      -1.0),\n                new Grad3( 2.22474487139,       2.22474487139,       1.0),\n                new Grad3( 3.0862664687972017,  1.1721513422464978,  0.0),\n                new Grad3( 1.1721513422464978,  3.0862664687972017,  0.0)\n            };\n            for (int i = 0; i < grad3.Length; i++)\n            {\n                grad3[i].dx /= N3; grad3[i].dy /= N3; grad3[i].dz /= N3;\n            }\n            for (int i = 0; i < PSIZE; i++)\n            {\n                GRADIENTS_3D[i] = grad3[i % grad3.Length];\n            }\n\n            GRADIENTS_4D = new Grad4[PSIZE];\n            Grad4[] grad4 = {\n                new Grad4(-0.753341017856078,    -0.37968289875261624,  -0.37968289875261624,  -0.37968289875261624),\n                new Grad4(-0.7821684431180708,   -0.4321472685365301,   -0.4321472685365301,    0.12128480194602098),\n                new Grad4(-0.7821684431180708,   -0.4321472685365301,    0.12128480194602098,  -0.4321472685365301),\n                new Grad4(-0.7821684431180708,    0.12128480194602098,  -0.4321472685365301,   -0.4321472685365301),\n                new Grad4(-0.8586508742123365,   -0.508629699630796,     0.044802370851755174,  0.044802370851755174),\n                new Grad4(-0.8586508742123365,    0.044802370851755174, -0.508629699630796,     0.044802370851755174),\n                new Grad4(-0.8586508742123365,    0.044802370851755174,  0.044802370851755174, -0.508629699630796),\n                new Grad4(-0.9982828964265062,   -0.03381941603233842,  -0.03381941603233842,  -0.03381941603233842),\n                new Grad4(-0.37968289875261624,  -0.753341017856078,    -0.37968289875261624,  -0.37968289875261624),\n                new Grad4(-0.4321472685365301,   -0.7821684431180708,   -0.4321472685365301,    0.12128480194602098),\n                new Grad4(-0.4321472685365301,   -0.7821684431180708,    0.12128480194602098,  -0.4321472685365301),\n                new Grad4( 0.12128480194602098,  -0.7821684431180708,   -0.4321472685365301,   -0.4321472685365301),\n                new Grad4(-0.508629699630796,    -0.8586508742123365,    0.044802370851755174,  0.044802370851755174),\n                new Grad4( 0.044802370851755174, -0.8586508742123365,   -0.508629699630796,     0.044802370851755174),\n                new Grad4( 0.044802370851755174, -0.8586508742123365,    0.044802370851755174, -0.508629699630796),\n                new Grad4(-0.03381941603233842,  -0.9982828964265062,   -0.03381941603233842,  -0.03381941603233842),\n                new Grad4(-0.37968289875261624,  -0.37968289875261624,  -0.753341017856078,    -0.37968289875261624),\n                new Grad4(-0.4321472685365301,   -0.4321472685365301,   -0.7821684431180708,    0.12128480194602098),\n                new Grad4(-0.4321472685365301,    0.12128480194602098,  -0.7821684431180708,   -0.4321472685365301),\n                new Grad4( 0.12128480194602098,  -0.4321472685365301,   -0.7821684431180708,   -0.4321472685365301),\n                new Grad4(-0.508629699630796,     0.044802370851755174, -0.8586508742123365,    0.044802370851755174),\n                new Grad4( 0.044802370851755174, -0.508629699630796,    -0.8586508742123365,    0.044802370851755174),\n                new Grad4( 0.044802370851755174,  0.044802370851755174, -0.8586508742123365,   -0.508629699630796),\n                new Grad4(-0.03381941603233842,  -0.03381941603233842,  -0.9982828964265062,   -0.03381941603233842),\n                new Grad4(-0.37968289875261624,  -0.37968289875261624,  -0.37968289875261624,  -0.753341017856078),\n                new Grad4(-0.4321472685365301,   -0.4321472685365301,    0.12128480194602098,  -0.7821684431180708),\n                new Grad4(-0.4321472685365301,    0.12128480194602098,  -0.4321472685365301,   -0.7821684431180708),\n                new Grad4( 0.12128480194602098,  -0.4321472685365301,   -0.4321472685365301,   -0.7821684431180708),\n                new Grad4(-0.508629699630796,     0.044802370851755174,  0.044802370851755174, -0.8586508742123365),\n                new Grad4( 0.044802370851755174, -0.508629699630796,     0.044802370851755174, -0.8586508742123365),\n                new Grad4( 0.044802370851755174,  0.044802370851755174, -0.508629699630796,    -0.8586508742123365),\n                new Grad4(-0.03381941603233842,  -0.03381941603233842,  -0.03381941603233842,  -0.9982828964265062),\n                new Grad4(-0.6740059517812944,   -0.3239847771997537,   -0.3239847771997537,    0.5794684678643381),\n                new Grad4(-0.7504883828755602,   -0.4004672082940195,    0.15296486218853164,   0.5029860367700724),\n                new Grad4(-0.7504883828755602,    0.15296486218853164,  -0.4004672082940195,    0.5029860367700724),\n                new Grad4(-0.8828161875373585,    0.08164729285680945,   0.08164729285680945,   0.4553054119602712),\n                new Grad4(-0.4553054119602712,   -0.08164729285680945,  -0.08164729285680945,   0.8828161875373585),\n                new Grad4(-0.5029860367700724,   -0.15296486218853164,   0.4004672082940195,    0.7504883828755602),\n                new Grad4(-0.5029860367700724,    0.4004672082940195,   -0.15296486218853164,   0.7504883828755602),\n                new Grad4(-0.5794684678643381,    0.3239847771997537,    0.3239847771997537,    0.6740059517812944),\n                new Grad4(-0.3239847771997537,   -0.6740059517812944,   -0.3239847771997537,    0.5794684678643381),\n                new Grad4(-0.4004672082940195,   -0.7504883828755602,    0.15296486218853164,   0.5029860367700724),\n                new Grad4( 0.15296486218853164,  -0.7504883828755602,   -0.4004672082940195,    0.5029860367700724),\n                new Grad4( 0.08164729285680945,  -0.8828161875373585,    0.08164729285680945,   0.4553054119602712),\n                new Grad4(-0.08164729285680945,  -0.4553054119602712,   -0.08164729285680945,   0.8828161875373585),\n                new Grad4(-0.15296486218853164,  -0.5029860367700724,    0.4004672082940195,    0.7504883828755602),\n                new Grad4( 0.4004672082940195,   -0.5029860367700724,   -0.15296486218853164,   0.7504883828755602),\n                new Grad4( 0.3239847771997537,   -0.5794684678643381,    0.3239847771997537,    0.6740059517812944),\n                new Grad4(-0.3239847771997537,   -0.3239847771997537,   -0.6740059517812944,    0.5794684678643381),\n                new Grad4(-0.4004672082940195,    0.15296486218853164,  -0.7504883828755602,    0.5029860367700724),\n                new Grad4( 0.15296486218853164,  -0.4004672082940195,   -0.7504883828755602,    0.5029860367700724),\n                new Grad4( 0.08164729285680945,   0.08164729285680945,  -0.8828161875373585,    0.4553054119602712),\n                new Grad4(-0.08164729285680945,  -0.08164729285680945,  -0.4553054119602712,    0.8828161875373585),\n                new Grad4(-0.15296486218853164,   0.4004672082940195,   -0.5029860367700724,    0.7504883828755602),\n                new Grad4( 0.4004672082940195,   -0.15296486218853164,  -0.5029860367700724,    0.7504883828755602),\n                new Grad4( 0.3239847771997537,    0.3239847771997537,   -0.5794684678643381,    0.6740059517812944),\n                new Grad4(-0.6740059517812944,   -0.3239847771997537,    0.5794684678643381,   -0.3239847771997537),\n                new Grad4(-0.7504883828755602,   -0.4004672082940195,    0.5029860367700724,    0.15296486218853164),\n                new Grad4(-0.7504883828755602,    0.15296486218853164,   0.5029860367700724,   -0.4004672082940195),\n                new Grad4(-0.8828161875373585,    0.08164729285680945,   0.4553054119602712,    0.08164729285680945),\n                new Grad4(-0.4553054119602712,   -0.08164729285680945,   0.8828161875373585,   -0.08164729285680945),\n                new Grad4(-0.5029860367700724,   -0.15296486218853164,   0.7504883828755602,    0.4004672082940195),\n                new Grad4(-0.5029860367700724,    0.4004672082940195,    0.7504883828755602,   -0.15296486218853164),\n                new Grad4(-0.5794684678643381,    0.3239847771997537,    0.6740059517812944,    0.3239847771997537),\n                new Grad4(-0.3239847771997537,   -0.6740059517812944,    0.5794684678643381,   -0.3239847771997537),\n                new Grad4(-0.4004672082940195,   -0.7504883828755602,    0.5029860367700724,    0.15296486218853164),\n                new Grad4( 0.15296486218853164,  -0.7504883828755602,    0.5029860367700724,   -0.4004672082940195),\n                new Grad4( 0.08164729285680945,  -0.8828161875373585,    0.4553054119602712,    0.08164729285680945),\n                new Grad4(-0.08164729285680945,  -0.4553054119602712,    0.8828161875373585,   -0.08164729285680945),\n                new Grad4(-0.15296486218853164,  -0.5029860367700724,    0.7504883828755602,    0.4004672082940195),\n                new Grad4( 0.4004672082940195,   -0.5029860367700724,    0.7504883828755602,   -0.15296486218853164),\n                new Grad4( 0.3239847771997537,   -0.5794684678643381,    0.6740059517812944,    0.3239847771997537),\n                new Grad4(-0.3239847771997537,   -0.3239847771997537,    0.5794684678643381,   -0.6740059517812944),\n                new Grad4(-0.4004672082940195,    0.15296486218853164,   0.5029860367700724,   -0.7504883828755602),\n                new Grad4( 0.15296486218853164,  -0.4004672082940195,    0.5029860367700724,   -0.7504883828755602),\n                new Grad4( 0.08164729285680945,   0.08164729285680945,   0.4553054119602712,   -0.8828161875373585),\n                new Grad4(-0.08164729285680945,  -0.08164729285680945,   0.8828161875373585,   -0.4553054119602712),\n                new Grad4(-0.15296486218853164,   0.4004672082940195,    0.7504883828755602,   -0.5029860367700724),\n                new Grad4( 0.4004672082940195,   -0.15296486218853164,   0.7504883828755602,   -0.5029860367700724),\n                new Grad4( 0.3239847771997537,    0.3239847771997537,    0.6740059517812944,   -0.5794684678643381),\n                new Grad4(-0.6740059517812944,    0.5794684678643381,   -0.3239847771997537,   -0.3239847771997537),\n                new Grad4(-0.7504883828755602,    0.5029860367700724,   -0.4004672082940195,    0.15296486218853164),\n                new Grad4(-0.7504883828755602,    0.5029860367700724,    0.15296486218853164,  -0.4004672082940195),\n                new Grad4(-0.8828161875373585,    0.4553054119602712,    0.08164729285680945,   0.08164729285680945),\n                new Grad4(-0.4553054119602712,    0.8828161875373585,   -0.08164729285680945,  -0.08164729285680945),\n                new Grad4(-0.5029860367700724,    0.7504883828755602,   -0.15296486218853164,   0.4004672082940195),\n                new Grad4(-0.5029860367700724,    0.7504883828755602,    0.4004672082940195,   -0.15296486218853164),\n                new Grad4(-0.5794684678643381,    0.6740059517812944,    0.3239847771997537,    0.3239847771997537),\n                new Grad4(-0.3239847771997537,    0.5794684678643381,   -0.6740059517812944,   -0.3239847771997537),\n                new Grad4(-0.4004672082940195,    0.5029860367700724,   -0.7504883828755602,    0.15296486218853164),\n                new Grad4( 0.15296486218853164,   0.5029860367700724,   -0.7504883828755602,   -0.4004672082940195),\n                new Grad4( 0.08164729285680945,   0.4553054119602712,   -0.8828161875373585,    0.08164729285680945),\n                new Grad4(-0.08164729285680945,   0.8828161875373585,   -0.4553054119602712,   -0.08164729285680945),\n                new Grad4(-0.15296486218853164,   0.7504883828755602,   -0.5029860367700724,    0.4004672082940195),\n                new Grad4( 0.4004672082940195,    0.7504883828755602,   -0.5029860367700724,   -0.15296486218853164),\n                new Grad4( 0.3239847771997537,    0.6740059517812944,   -0.5794684678643381,    0.3239847771997537),\n                new Grad4(-0.3239847771997537,    0.5794684678643381,   -0.3239847771997537,   -0.6740059517812944),\n                new Grad4(-0.4004672082940195,    0.5029860367700724,    0.15296486218853164,  -0.7504883828755602),\n                new Grad4( 0.15296486218853164,   0.5029860367700724,   -0.4004672082940195,   -0.7504883828755602),\n                new Grad4( 0.08164729285680945,   0.4553054119602712,    0.08164729285680945,  -0.8828161875373585),\n                new Grad4(-0.08164729285680945,   0.8828161875373585,   -0.08164729285680945,  -0.4553054119602712),\n                new Grad4(-0.15296486218853164,   0.7504883828755602,    0.4004672082940195,   -0.5029860367700724),\n                new Grad4( 0.4004672082940195,    0.7504883828755602,   -0.15296486218853164,  -0.5029860367700724),\n                new Grad4( 0.3239847771997537,    0.6740059517812944,    0.3239847771997537,   -0.5794684678643381),\n                new Grad4( 0.5794684678643381,   -0.6740059517812944,   -0.3239847771997537,   -0.3239847771997537),\n                new Grad4( 0.5029860367700724,   -0.7504883828755602,   -0.4004672082940195,    0.15296486218853164),\n                new Grad4( 0.5029860367700724,   -0.7504883828755602,    0.15296486218853164,  -0.4004672082940195),\n                new Grad4( 0.4553054119602712,   -0.8828161875373585,    0.08164729285680945,   0.08164729285680945),\n                new Grad4( 0.8828161875373585,   -0.4553054119602712,   -0.08164729285680945,  -0.08164729285680945),\n                new Grad4( 0.7504883828755602,   -0.5029860367700724,   -0.15296486218853164,   0.4004672082940195),\n                new Grad4( 0.7504883828755602,   -0.5029860367700724,    0.4004672082940195,   -0.15296486218853164),\n                new Grad4( 0.6740059517812944,   -0.5794684678643381,    0.3239847771997537,    0.3239847771997537),\n                new Grad4( 0.5794684678643381,   -0.3239847771997537,   -0.6740059517812944,   -0.3239847771997537),\n                new Grad4( 0.5029860367700724,   -0.4004672082940195,   -0.7504883828755602,    0.15296486218853164),\n                new Grad4( 0.5029860367700724,    0.15296486218853164,  -0.7504883828755602,   -0.4004672082940195),\n                new Grad4( 0.4553054119602712,    0.08164729285680945,  -0.8828161875373585,    0.08164729285680945),\n                new Grad4( 0.8828161875373585,   -0.08164729285680945,  -0.4553054119602712,   -0.08164729285680945),\n                new Grad4( 0.7504883828755602,   -0.15296486218853164,  -0.5029860367700724,    0.4004672082940195),\n                new Grad4( 0.7504883828755602,    0.4004672082940195,   -0.5029860367700724,   -0.15296486218853164),\n                new Grad4( 0.6740059517812944,    0.3239847771997537,   -0.5794684678643381,    0.3239847771997537),\n                new Grad4( 0.5794684678643381,   -0.3239847771997537,   -0.3239847771997537,   -0.6740059517812944),\n                new Grad4( 0.5029860367700724,   -0.4004672082940195,    0.15296486218853164,  -0.7504883828755602),\n                new Grad4( 0.5029860367700724,    0.15296486218853164,  -0.4004672082940195,   -0.7504883828755602),\n                new Grad4( 0.4553054119602712,    0.08164729285680945,   0.08164729285680945,  -0.8828161875373585),\n                new Grad4( 0.8828161875373585,   -0.08164729285680945,  -0.08164729285680945,  -0.4553054119602712),\n                new Grad4( 0.7504883828755602,   -0.15296486218853164,   0.4004672082940195,   -0.5029860367700724),\n                new Grad4( 0.7504883828755602,    0.4004672082940195,   -0.15296486218853164,  -0.5029860367700724),\n                new Grad4( 0.6740059517812944,    0.3239847771997537,    0.3239847771997537,   -0.5794684678643381),\n                new Grad4( 0.03381941603233842,   0.03381941603233842,   0.03381941603233842,   0.9982828964265062),\n                new Grad4(-0.044802370851755174, -0.044802370851755174,  0.508629699630796,     0.8586508742123365),\n                new Grad4(-0.044802370851755174,  0.508629699630796,    -0.044802370851755174,  0.8586508742123365),\n                new Grad4(-0.12128480194602098,   0.4321472685365301,    0.4321472685365301,    0.7821684431180708),\n                new Grad4( 0.508629699630796,    -0.044802370851755174, -0.044802370851755174,  0.8586508742123365),\n                new Grad4( 0.4321472685365301,   -0.12128480194602098,   0.4321472685365301,    0.7821684431180708),\n                new Grad4( 0.4321472685365301,    0.4321472685365301,   -0.12128480194602098,   0.7821684431180708),\n                new Grad4( 0.37968289875261624,   0.37968289875261624,   0.37968289875261624,   0.753341017856078),\n                new Grad4( 0.03381941603233842,   0.03381941603233842,   0.9982828964265062,    0.03381941603233842),\n                new Grad4(-0.044802370851755174,  0.044802370851755174,  0.8586508742123365,    0.508629699630796),\n                new Grad4(-0.044802370851755174,  0.508629699630796,     0.8586508742123365,   -0.044802370851755174),\n                new Grad4(-0.12128480194602098,   0.4321472685365301,    0.7821684431180708,    0.4321472685365301),\n                new Grad4( 0.508629699630796,    -0.044802370851755174,  0.8586508742123365,   -0.044802370851755174),\n                new Grad4( 0.4321472685365301,   -0.12128480194602098,   0.7821684431180708,    0.4321472685365301),\n                new Grad4( 0.4321472685365301,    0.4321472685365301,    0.7821684431180708,   -0.12128480194602098),\n                new Grad4( 0.37968289875261624,   0.37968289875261624,   0.753341017856078,     0.37968289875261624),\n                new Grad4( 0.03381941603233842,   0.9982828964265062,    0.03381941603233842,   0.03381941603233842),\n                new Grad4(-0.044802370851755174,  0.8586508742123365,   -0.044802370851755174,  0.508629699630796),\n                new Grad4(-0.044802370851755174,  0.8586508742123365,    0.508629699630796,    -0.044802370851755174),\n                new Grad4(-0.12128480194602098,   0.7821684431180708,    0.4321472685365301,    0.4321472685365301),\n                new Grad4( 0.508629699630796,     0.8586508742123365,   -0.044802370851755174, -0.044802370851755174),\n                new Grad4( 0.4321472685365301,    0.7821684431180708,   -0.12128480194602098,   0.4321472685365301),\n                new Grad4( 0.4321472685365301,    0.7821684431180708,    0.4321472685365301,   -0.12128480194602098),\n                new Grad4( 0.37968289875261624,   0.753341017856078,     0.37968289875261624,   0.37968289875261624),\n                new Grad4( 0.9982828964265062,    0.03381941603233842,   0.03381941603233842,   0.03381941603233842),\n                new Grad4( 0.8586508742123365,   -0.044802370851755174, -0.044802370851755174,  0.508629699630796),\n                new Grad4( 0.8586508742123365,   -0.044802370851755174,  0.508629699630796,    -0.044802370851755174),\n                new Grad4( 0.7821684431180708,   -0.12128480194602098,   0.4321472685365301,    0.4321472685365301),\n                new Grad4( 0.8586508742123365,    0.508629699630796,    -0.044802370851755174, -0.044802370851755174),\n                new Grad4( 0.7821684431180708,    0.4321472685365301,   -0.12128480194602098,   0.4321472685365301),\n                new Grad4( 0.7821684431180708,    0.4321472685365301,    0.4321472685365301,   -0.12128480194602098),\n                new Grad4( 0.753341017856078,     0.37968289875261624,   0.37968289875261624,   0.37968289875261624)\n            };\n            for (int i = 0; i < grad4.Length; i++)\n            {\n                grad4[i].dx /= N4; grad4[i].dy /= N4; grad4[i].dz /= N4; grad4[i].dw /= N4;\n            }\n            for (int i = 0; i < PSIZE; i++)\n            {\n                GRADIENTS_4D[i] = grad4[i % grad4.Length];\n            }\n        }\n\n        private struct LatticePoint2D\n        {\n            public int xsv, ysv;\n            public double dx, dy;\n            public LatticePoint2D(int xsv, int ysv)\n            {\n                this.xsv = xsv; this.ysv = ysv;\n                double ssv = (xsv + ysv) * -0.211324865405187;\n                this.dx = -xsv - ssv;\n                this.dy = -ysv - ssv;\n            }\n        }\n\n        private class LatticePoint3D\n        {\n            public double dxr, dyr, dzr;\n            public int xrv, yrv, zrv;\n            public LatticePoint3D NextOnFailure, NextOnSuccess;\n            public LatticePoint3D(int xrv, int yrv, int zrv, int lattice)\n            {\n                this.dxr = -xrv + lattice * 0.5; this.dyr = -yrv + lattice * 0.5; this.dzr = -zrv + lattice * 0.5;\n                this.xrv = xrv + lattice * 1024; this.yrv = yrv + lattice * 1024; this.zrv = zrv + lattice * 1024;\n            }\n        }\n\n        private class LatticePoint4D\n        {\n            public int xsv, ysv, zsv, wsv;\n            public double dx, dy, dz, dw;\n            public LatticePoint4D(int xsv, int ysv, int zsv, int wsv)\n            {\n                this.xsv = xsv; this.ysv = ysv; this.zsv = zsv; this.wsv = wsv;\n                double ssv = (xsv + ysv + zsv + wsv) * -0.138196601125011;\n                this.dx = -xsv - ssv;\n                this.dy = -ysv - ssv;\n                this.dz = -zsv - ssv;\n                this.dw = -wsv - ssv;\n            }\n        }\n\n        private struct Grad2\n        {\n            public double dx, dy;\n            public Grad2(double dx, double dy)\n            {\n                this.dx = dx; this.dy = dy;\n            }\n        }\n\n        private struct Grad3\n        {\n            public double dx, dy, dz;\n            public Grad3(double dx, double dy, double dz)\n            {\n                this.dx = dx; this.dy = dy; this.dz = dz;\n            }\n        }\n\n        private struct Grad4\n        {\n            public double dx, dy, dz, dw;\n            public Grad4(double dx, double dy, double dz, double dw)\n            {\n                this.dx = dx; this.dy = dy; this.dz = dz; this.dw = dw;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "_old/csharp/legacy/OpenSimplex.cs",
    "content": "/**\n * K.jpg's original OpenSimplex Noise\n * DigitalShadow's optimized implementation, https://gist.github.com/digitalshadow/134a3a02b67cecd72181/\n * with updated gradient sets (Dec 2019, Feb 2020)\n *\n * If 4D noise is not needed, is recommended to use OpenSimplex2 instead.\n * Choose OpenSimplex2S for comparable smoothness, or choose OpenSimplex2F for speed.\n * If 4D noise is needed, 4D OpenSimplex2 will come, but this can suffice.\n *\n * XYBeforeZ and XZBeforeY functions for 3D have been added, though they aren't as nice as in OpenSimplex2\n */\n\nusing System;\nusing System.Runtime.CompilerServices;\n\nnamespace NoiseTest\n{\n    public class OpenSimplex\n    {\n        private const double STRETCH_2D = -0.211324865405187;    // (1/Math.sqrt(2+1)-1)/2;\n        private const double STRETCH_3D = -1.0 / 6.0;            // (1/Math.sqrt(3+1)-1)/3;\n        private const double STRETCH_4D = -0.138196601125011;    // (1/Math.sqrt(4+1)-1)/4;\n        private const double SQUISH_2D = 0.366025403784439;      // (Math.sqrt(2+1)-1)/2;\n        private const double SQUISH_3D = 1.0 / 3.0;              // (Math.sqrt(3+1)-1)/3;\n        private const double SQUISH_4D = 0.309016994374947;      // (Math.sqrt(4+1)-1)/4;\n        private const int PSIZE = 2048;\n        private const int PMASK = 2047;\n        private const double N2 = 7.69084574549313;\n        private const double N3 = 26.92263139946168;\n        private const double N4 = 8.881759591352166;\n\n        private short[] perm;\n        private Grad2[] permGrad2;\n        private Grad3[] permGrad3;\n        private Grad4[] permGrad4;\n\n        private static Grad2[] gradients2D;\n        private static Grad3[] gradients3D;\n        private static Grad4[] gradients4D;\n\n        private static Contribution2[] lookup2D;\n        private static Contribution3[] lookup3D;\n        private static Contribution4[] lookup4D;\n\n        static OpenSimplex()\n        {\n            gradients2D = new Grad2[PSIZE];\n            Grad2[] grad2 = {\n                new Grad2( 0.130526192220052,  0.99144486137381),\n                new Grad2( 0.38268343236509,   0.923879532511287),\n                new Grad2( 0.608761429008721,  0.793353340291235),\n                new Grad2( 0.793353340291235,  0.608761429008721),\n                new Grad2( 0.923879532511287,  0.38268343236509),\n                new Grad2( 0.99144486137381,   0.130526192220051),\n                new Grad2( 0.99144486137381,  -0.130526192220051),\n                new Grad2( 0.923879532511287, -0.38268343236509),\n                new Grad2( 0.793353340291235, -0.60876142900872),\n                new Grad2( 0.608761429008721, -0.793353340291235),\n                new Grad2( 0.38268343236509,  -0.923879532511287),\n                new Grad2( 0.130526192220052, -0.99144486137381),\n                new Grad2(-0.130526192220052, -0.99144486137381),\n                new Grad2(-0.38268343236509,  -0.923879532511287),\n                new Grad2(-0.608761429008721, -0.793353340291235),\n                new Grad2(-0.793353340291235, -0.608761429008721),\n                new Grad2(-0.923879532511287, -0.38268343236509),\n                new Grad2(-0.99144486137381,  -0.130526192220052),\n                new Grad2(-0.99144486137381,   0.130526192220051),\n                new Grad2(-0.923879532511287,  0.38268343236509),\n                new Grad2(-0.793353340291235,  0.608761429008721),\n                new Grad2(-0.608761429008721,  0.793353340291235),\n                new Grad2(-0.38268343236509,   0.923879532511287),\n                new Grad2(-0.130526192220052,  0.99144486137381)\n            };\n            for (int i = 0; i < grad2.Length; i++)\n            {\n                grad2[i].dx /= N2; grad2[i].dy /= N2;\n            }\n            for (int i = 0; i < PSIZE; i++)\n            {\n                gradients2D[i] = grad2[i % grad2.Length];\n            }\n\n            gradients3D = new Grad3[PSIZE];\n            Grad3[] grad3 = {\n                new Grad3(-1.4082482904633333,    -1.4082482904633333,    -2.6329931618533333),\n                new Grad3(-0.07491495712999985,   -0.07491495712999985,   -3.29965982852),\n                new Grad3( 0.24732126143473554,   -1.6667938651159684,    -2.838945207362466),\n                new Grad3(-1.6667938651159684,     0.24732126143473554,   -2.838945207362466),\n                new Grad3(-1.4082482904633333,    -2.6329931618533333,    -1.4082482904633333),\n                new Grad3(-0.07491495712999985,   -3.29965982852,         -0.07491495712999985),\n                new Grad3(-1.6667938651159684,    -2.838945207362466,      0.24732126143473554),\n                new Grad3( 0.24732126143473554,   -2.838945207362466,     -1.6667938651159684),\n                new Grad3( 1.5580782047233335,     0.33333333333333337,   -2.8914115380566665),\n                new Grad3( 2.8914115380566665,    -0.33333333333333337,   -1.5580782047233335),\n                new Grad3( 1.8101897177633992,    -1.2760767510338025,    -2.4482280932803),\n                new Grad3( 2.4482280932803,        1.2760767510338025,    -1.8101897177633992),\n                new Grad3( 1.5580782047233335,    -2.8914115380566665,     0.33333333333333337),\n                new Grad3( 2.8914115380566665,    -1.5580782047233335,    -0.33333333333333337),\n                new Grad3( 2.4482280932803,       -1.8101897177633992,     1.2760767510338025),\n                new Grad3( 1.8101897177633992,    -2.4482280932803,       -1.2760767510338025),\n                new Grad3(-2.6329931618533333,    -1.4082482904633333,    -1.4082482904633333),\n                new Grad3(-3.29965982852,         -0.07491495712999985,   -0.07491495712999985),\n                new Grad3(-2.838945207362466,      0.24732126143473554,   -1.6667938651159684),\n                new Grad3(-2.838945207362466,     -1.6667938651159684,     0.24732126143473554),\n                new Grad3( 0.33333333333333337,    1.5580782047233335,    -2.8914115380566665),\n                new Grad3(-0.33333333333333337,    2.8914115380566665,    -1.5580782047233335),\n                new Grad3( 1.2760767510338025,     2.4482280932803,       -1.8101897177633992),\n                new Grad3(-1.2760767510338025,     1.8101897177633992,    -2.4482280932803),\n                new Grad3( 0.33333333333333337,   -2.8914115380566665,     1.5580782047233335),\n                new Grad3(-0.33333333333333337,   -1.5580782047233335,     2.8914115380566665),\n                new Grad3(-1.2760767510338025,    -2.4482280932803,        1.8101897177633992),\n                new Grad3( 1.2760767510338025,    -1.8101897177633992,     2.4482280932803),\n                new Grad3( 3.29965982852,          0.07491495712999985,    0.07491495712999985),\n                new Grad3( 2.6329931618533333,     1.4082482904633333,     1.4082482904633333),\n                new Grad3( 2.838945207362466,     -0.24732126143473554,    1.6667938651159684),\n                new Grad3( 2.838945207362466,      1.6667938651159684,    -0.24732126143473554),\n                new Grad3(-2.8914115380566665,     1.5580782047233335,     0.33333333333333337),\n                new Grad3(-1.5580782047233335,     2.8914115380566665,    -0.33333333333333337),\n                new Grad3(-2.4482280932803,        1.8101897177633992,    -1.2760767510338025),\n                new Grad3(-1.8101897177633992,     2.4482280932803,        1.2760767510338025),\n                new Grad3(-2.8914115380566665,     0.33333333333333337,    1.5580782047233335),\n                new Grad3(-1.5580782047233335,    -0.33333333333333337,    2.8914115380566665),\n                new Grad3(-1.8101897177633992,     1.2760767510338025,     2.4482280932803),\n                new Grad3(-2.4482280932803,       -1.2760767510338025,     1.8101897177633992),\n                new Grad3( 0.07491495712999985,    3.29965982852,          0.07491495712999985),\n                new Grad3( 1.4082482904633333,     2.6329931618533333,     1.4082482904633333),\n                new Grad3( 1.6667938651159684,     2.838945207362466,     -0.24732126143473554),\n                new Grad3(-0.24732126143473554,    2.838945207362466,      1.6667938651159684),\n                new Grad3( 0.07491495712999985,    0.07491495712999985,    3.29965982852),\n                new Grad3( 1.4082482904633333,     1.4082482904633333,     2.6329931618533333),\n                new Grad3(-0.24732126143473554,    1.6667938651159684,     2.838945207362466),\n                new Grad3( 1.6667938651159684,    -0.24732126143473554,    2.838945207362466)\n            };\n            for (int i = 0; i < grad3.Length; i++)\n            {\n                grad3[i].dx /= N3; grad3[i].dy /= N3; grad3[i].dz /= N3;\n            }\n            for (int i = 0; i < PSIZE; i++)\n            {\n                gradients3D[i] = grad3[i % grad3.Length];\n            }\n\n            gradients4D = new Grad4[PSIZE];\n            Grad4[] grad4 = {\n                new Grad4(-0.753341017856078,    -0.37968289875261624,  -0.37968289875261624,  -0.37968289875261624),\n                new Grad4(-0.7821684431180708,   -0.4321472685365301,   -0.4321472685365301,    0.12128480194602098),\n                new Grad4(-0.7821684431180708,   -0.4321472685365301,    0.12128480194602098,  -0.4321472685365301),\n                new Grad4(-0.7821684431180708,    0.12128480194602098,  -0.4321472685365301,   -0.4321472685365301),\n                new Grad4(-0.8586508742123365,   -0.508629699630796,     0.044802370851755174,  0.044802370851755174),\n                new Grad4(-0.8586508742123365,    0.044802370851755174, -0.508629699630796,     0.044802370851755174),\n                new Grad4(-0.8586508742123365,    0.044802370851755174,  0.044802370851755174, -0.508629699630796),\n                new Grad4(-0.9982828964265062,   -0.03381941603233842,  -0.03381941603233842,  -0.03381941603233842),\n                new Grad4(-0.37968289875261624,  -0.753341017856078,    -0.37968289875261624,  -0.37968289875261624),\n                new Grad4(-0.4321472685365301,   -0.7821684431180708,   -0.4321472685365301,    0.12128480194602098),\n                new Grad4(-0.4321472685365301,   -0.7821684431180708,    0.12128480194602098,  -0.4321472685365301),\n                new Grad4( 0.12128480194602098,  -0.7821684431180708,   -0.4321472685365301,   -0.4321472685365301),\n                new Grad4(-0.508629699630796,    -0.8586508742123365,    0.044802370851755174,  0.044802370851755174),\n                new Grad4( 0.044802370851755174, -0.8586508742123365,   -0.508629699630796,     0.044802370851755174),\n                new Grad4( 0.044802370851755174, -0.8586508742123365,    0.044802370851755174, -0.508629699630796),\n                new Grad4(-0.03381941603233842,  -0.9982828964265062,   -0.03381941603233842,  -0.03381941603233842),\n                new Grad4(-0.37968289875261624,  -0.37968289875261624,  -0.753341017856078,    -0.37968289875261624),\n                new Grad4(-0.4321472685365301,   -0.4321472685365301,   -0.7821684431180708,    0.12128480194602098),\n                new Grad4(-0.4321472685365301,    0.12128480194602098,  -0.7821684431180708,   -0.4321472685365301),\n                new Grad4( 0.12128480194602098,  -0.4321472685365301,   -0.7821684431180708,   -0.4321472685365301),\n                new Grad4(-0.508629699630796,     0.044802370851755174, -0.8586508742123365,    0.044802370851755174),\n                new Grad4( 0.044802370851755174, -0.508629699630796,    -0.8586508742123365,    0.044802370851755174),\n                new Grad4( 0.044802370851755174,  0.044802370851755174, -0.8586508742123365,   -0.508629699630796),\n                new Grad4(-0.03381941603233842,  -0.03381941603233842,  -0.9982828964265062,   -0.03381941603233842),\n                new Grad4(-0.37968289875261624,  -0.37968289875261624,  -0.37968289875261624,  -0.753341017856078),\n                new Grad4(-0.4321472685365301,   -0.4321472685365301,    0.12128480194602098,  -0.7821684431180708),\n                new Grad4(-0.4321472685365301,    0.12128480194602098,  -0.4321472685365301,   -0.7821684431180708),\n                new Grad4( 0.12128480194602098,  -0.4321472685365301,   -0.4321472685365301,   -0.7821684431180708),\n                new Grad4(-0.508629699630796,     0.044802370851755174,  0.044802370851755174, -0.8586508742123365),\n                new Grad4( 0.044802370851755174, -0.508629699630796,     0.044802370851755174, -0.8586508742123365),\n                new Grad4( 0.044802370851755174,  0.044802370851755174, -0.508629699630796,    -0.8586508742123365),\n                new Grad4(-0.03381941603233842,  -0.03381941603233842,  -0.03381941603233842,  -0.9982828964265062),\n                new Grad4(-0.6740059517812944,   -0.3239847771997537,   -0.3239847771997537,    0.5794684678643381),\n                new Grad4(-0.7504883828755602,   -0.4004672082940195,    0.15296486218853164,   0.5029860367700724),\n                new Grad4(-0.7504883828755602,    0.15296486218853164,  -0.4004672082940195,    0.5029860367700724),\n                new Grad4(-0.8828161875373585,    0.08164729285680945,   0.08164729285680945,   0.4553054119602712),\n                new Grad4(-0.4553054119602712,   -0.08164729285680945,  -0.08164729285680945,   0.8828161875373585),\n                new Grad4(-0.5029860367700724,   -0.15296486218853164,   0.4004672082940195,    0.7504883828755602),\n                new Grad4(-0.5029860367700724,    0.4004672082940195,   -0.15296486218853164,   0.7504883828755602),\n                new Grad4(-0.5794684678643381,    0.3239847771997537,    0.3239847771997537,    0.6740059517812944),\n                new Grad4(-0.3239847771997537,   -0.6740059517812944,   -0.3239847771997537,    0.5794684678643381),\n                new Grad4(-0.4004672082940195,   -0.7504883828755602,    0.15296486218853164,   0.5029860367700724),\n                new Grad4( 0.15296486218853164,  -0.7504883828755602,   -0.4004672082940195,    0.5029860367700724),\n                new Grad4( 0.08164729285680945,  -0.8828161875373585,    0.08164729285680945,   0.4553054119602712),\n                new Grad4(-0.08164729285680945,  -0.4553054119602712,   -0.08164729285680945,   0.8828161875373585),\n                new Grad4(-0.15296486218853164,  -0.5029860367700724,    0.4004672082940195,    0.7504883828755602),\n                new Grad4( 0.4004672082940195,   -0.5029860367700724,   -0.15296486218853164,   0.7504883828755602),\n                new Grad4( 0.3239847771997537,   -0.5794684678643381,    0.3239847771997537,    0.6740059517812944),\n                new Grad4(-0.3239847771997537,   -0.3239847771997537,   -0.6740059517812944,    0.5794684678643381),\n                new Grad4(-0.4004672082940195,    0.15296486218853164,  -0.7504883828755602,    0.5029860367700724),\n                new Grad4( 0.15296486218853164,  -0.4004672082940195,   -0.7504883828755602,    0.5029860367700724),\n                new Grad4( 0.08164729285680945,   0.08164729285680945,  -0.8828161875373585,    0.4553054119602712),\n                new Grad4(-0.08164729285680945,  -0.08164729285680945,  -0.4553054119602712,    0.8828161875373585),\n                new Grad4(-0.15296486218853164,   0.4004672082940195,   -0.5029860367700724,    0.7504883828755602),\n                new Grad4( 0.4004672082940195,   -0.15296486218853164,  -0.5029860367700724,    0.7504883828755602),\n                new Grad4( 0.3239847771997537,    0.3239847771997537,   -0.5794684678643381,    0.6740059517812944),\n                new Grad4(-0.6740059517812944,   -0.3239847771997537,    0.5794684678643381,   -0.3239847771997537),\n                new Grad4(-0.7504883828755602,   -0.4004672082940195,    0.5029860367700724,    0.15296486218853164),\n                new Grad4(-0.7504883828755602,    0.15296486218853164,   0.5029860367700724,   -0.4004672082940195),\n                new Grad4(-0.8828161875373585,    0.08164729285680945,   0.4553054119602712,    0.08164729285680945),\n                new Grad4(-0.4553054119602712,   -0.08164729285680945,   0.8828161875373585,   -0.08164729285680945),\n                new Grad4(-0.5029860367700724,   -0.15296486218853164,   0.7504883828755602,    0.4004672082940195),\n                new Grad4(-0.5029860367700724,    0.4004672082940195,    0.7504883828755602,   -0.15296486218853164),\n                new Grad4(-0.5794684678643381,    0.3239847771997537,    0.6740059517812944,    0.3239847771997537),\n                new Grad4(-0.3239847771997537,   -0.6740059517812944,    0.5794684678643381,   -0.3239847771997537),\n                new Grad4(-0.4004672082940195,   -0.7504883828755602,    0.5029860367700724,    0.15296486218853164),\n                new Grad4( 0.15296486218853164,  -0.7504883828755602,    0.5029860367700724,   -0.4004672082940195),\n                new Grad4( 0.08164729285680945,  -0.8828161875373585,    0.4553054119602712,    0.08164729285680945),\n                new Grad4(-0.08164729285680945,  -0.4553054119602712,    0.8828161875373585,   -0.08164729285680945),\n                new Grad4(-0.15296486218853164,  -0.5029860367700724,    0.7504883828755602,    0.4004672082940195),\n                new Grad4( 0.4004672082940195,   -0.5029860367700724,    0.7504883828755602,   -0.15296486218853164),\n                new Grad4( 0.3239847771997537,   -0.5794684678643381,    0.6740059517812944,    0.3239847771997537),\n                new Grad4(-0.3239847771997537,   -0.3239847771997537,    0.5794684678643381,   -0.6740059517812944),\n                new Grad4(-0.4004672082940195,    0.15296486218853164,   0.5029860367700724,   -0.7504883828755602),\n                new Grad4( 0.15296486218853164,  -0.4004672082940195,    0.5029860367700724,   -0.7504883828755602),\n                new Grad4( 0.08164729285680945,   0.08164729285680945,   0.4553054119602712,   -0.8828161875373585),\n                new Grad4(-0.08164729285680945,  -0.08164729285680945,   0.8828161875373585,   -0.4553054119602712),\n                new Grad4(-0.15296486218853164,   0.4004672082940195,    0.7504883828755602,   -0.5029860367700724),\n                new Grad4( 0.4004672082940195,   -0.15296486218853164,   0.7504883828755602,   -0.5029860367700724),\n                new Grad4( 0.3239847771997537,    0.3239847771997537,    0.6740059517812944,   -0.5794684678643381),\n                new Grad4(-0.6740059517812944,    0.5794684678643381,   -0.3239847771997537,   -0.3239847771997537),\n                new Grad4(-0.7504883828755602,    0.5029860367700724,   -0.4004672082940195,    0.15296486218853164),\n                new Grad4(-0.7504883828755602,    0.5029860367700724,    0.15296486218853164,  -0.4004672082940195),\n                new Grad4(-0.8828161875373585,    0.4553054119602712,    0.08164729285680945,   0.08164729285680945),\n                new Grad4(-0.4553054119602712,    0.8828161875373585,   -0.08164729285680945,  -0.08164729285680945),\n                new Grad4(-0.5029860367700724,    0.7504883828755602,   -0.15296486218853164,   0.4004672082940195),\n                new Grad4(-0.5029860367700724,    0.7504883828755602,    0.4004672082940195,   -0.15296486218853164),\n                new Grad4(-0.5794684678643381,    0.6740059517812944,    0.3239847771997537,    0.3239847771997537),\n                new Grad4(-0.3239847771997537,    0.5794684678643381,   -0.6740059517812944,   -0.3239847771997537),\n                new Grad4(-0.4004672082940195,    0.5029860367700724,   -0.7504883828755602,    0.15296486218853164),\n                new Grad4( 0.15296486218853164,   0.5029860367700724,   -0.7504883828755602,   -0.4004672082940195),\n                new Grad4( 0.08164729285680945,   0.4553054119602712,   -0.8828161875373585,    0.08164729285680945),\n                new Grad4(-0.08164729285680945,   0.8828161875373585,   -0.4553054119602712,   -0.08164729285680945),\n                new Grad4(-0.15296486218853164,   0.7504883828755602,   -0.5029860367700724,    0.4004672082940195),\n                new Grad4( 0.4004672082940195,    0.7504883828755602,   -0.5029860367700724,   -0.15296486218853164),\n                new Grad4( 0.3239847771997537,    0.6740059517812944,   -0.5794684678643381,    0.3239847771997537),\n                new Grad4(-0.3239847771997537,    0.5794684678643381,   -0.3239847771997537,   -0.6740059517812944),\n                new Grad4(-0.4004672082940195,    0.5029860367700724,    0.15296486218853164,  -0.7504883828755602),\n                new Grad4( 0.15296486218853164,   0.5029860367700724,   -0.4004672082940195,   -0.7504883828755602),\n                new Grad4( 0.08164729285680945,   0.4553054119602712,    0.08164729285680945,  -0.8828161875373585),\n                new Grad4(-0.08164729285680945,   0.8828161875373585,   -0.08164729285680945,  -0.4553054119602712),\n                new Grad4(-0.15296486218853164,   0.7504883828755602,    0.4004672082940195,   -0.5029860367700724),\n                new Grad4( 0.4004672082940195,    0.7504883828755602,   -0.15296486218853164,  -0.5029860367700724),\n                new Grad4( 0.3239847771997537,    0.6740059517812944,    0.3239847771997537,   -0.5794684678643381),\n                new Grad4( 0.5794684678643381,   -0.6740059517812944,   -0.3239847771997537,   -0.3239847771997537),\n                new Grad4( 0.5029860367700724,   -0.7504883828755602,   -0.4004672082940195,    0.15296486218853164),\n                new Grad4( 0.5029860367700724,   -0.7504883828755602,    0.15296486218853164,  -0.4004672082940195),\n                new Grad4( 0.4553054119602712,   -0.8828161875373585,    0.08164729285680945,   0.08164729285680945),\n                new Grad4( 0.8828161875373585,   -0.4553054119602712,   -0.08164729285680945,  -0.08164729285680945),\n                new Grad4( 0.7504883828755602,   -0.5029860367700724,   -0.15296486218853164,   0.4004672082940195),\n                new Grad4( 0.7504883828755602,   -0.5029860367700724,    0.4004672082940195,   -0.15296486218853164),\n                new Grad4( 0.6740059517812944,   -0.5794684678643381,    0.3239847771997537,    0.3239847771997537),\n                new Grad4( 0.5794684678643381,   -0.3239847771997537,   -0.6740059517812944,   -0.3239847771997537),\n                new Grad4( 0.5029860367700724,   -0.4004672082940195,   -0.7504883828755602,    0.15296486218853164),\n                new Grad4( 0.5029860367700724,    0.15296486218853164,  -0.7504883828755602,   -0.4004672082940195),\n                new Grad4( 0.4553054119602712,    0.08164729285680945,  -0.8828161875373585,    0.08164729285680945),\n                new Grad4( 0.8828161875373585,   -0.08164729285680945,  -0.4553054119602712,   -0.08164729285680945),\n                new Grad4( 0.7504883828755602,   -0.15296486218853164,  -0.5029860367700724,    0.4004672082940195),\n                new Grad4( 0.7504883828755602,    0.4004672082940195,   -0.5029860367700724,   -0.15296486218853164),\n                new Grad4( 0.6740059517812944,    0.3239847771997537,   -0.5794684678643381,    0.3239847771997537),\n                new Grad4( 0.5794684678643381,   -0.3239847771997537,   -0.3239847771997537,   -0.6740059517812944),\n                new Grad4( 0.5029860367700724,   -0.4004672082940195,    0.15296486218853164,  -0.7504883828755602),\n                new Grad4( 0.5029860367700724,    0.15296486218853164,  -0.4004672082940195,   -0.7504883828755602),\n                new Grad4( 0.4553054119602712,    0.08164729285680945,   0.08164729285680945,  -0.8828161875373585),\n                new Grad4( 0.8828161875373585,   -0.08164729285680945,  -0.08164729285680945,  -0.4553054119602712),\n                new Grad4( 0.7504883828755602,   -0.15296486218853164,   0.4004672082940195,   -0.5029860367700724),\n                new Grad4( 0.7504883828755602,    0.4004672082940195,   -0.15296486218853164,  -0.5029860367700724),\n                new Grad4( 0.6740059517812944,    0.3239847771997537,    0.3239847771997537,   -0.5794684678643381),\n                new Grad4( 0.03381941603233842,   0.03381941603233842,   0.03381941603233842,   0.9982828964265062),\n                new Grad4(-0.044802370851755174, -0.044802370851755174,  0.508629699630796,     0.8586508742123365),\n                new Grad4(-0.044802370851755174,  0.508629699630796,    -0.044802370851755174,  0.8586508742123365),\n                new Grad4(-0.12128480194602098,   0.4321472685365301,    0.4321472685365301,    0.7821684431180708),\n                new Grad4( 0.508629699630796,    -0.044802370851755174, -0.044802370851755174,  0.8586508742123365),\n                new Grad4( 0.4321472685365301,   -0.12128480194602098,   0.4321472685365301,    0.7821684431180708),\n                new Grad4( 0.4321472685365301,    0.4321472685365301,   -0.12128480194602098,   0.7821684431180708),\n                new Grad4( 0.37968289875261624,   0.37968289875261624,   0.37968289875261624,   0.753341017856078),\n                new Grad4( 0.03381941603233842,   0.03381941603233842,   0.9982828964265062,    0.03381941603233842),\n                new Grad4(-0.044802370851755174,  0.044802370851755174,  0.8586508742123365,    0.508629699630796),\n                new Grad4(-0.044802370851755174,  0.508629699630796,     0.8586508742123365,   -0.044802370851755174),\n                new Grad4(-0.12128480194602098,   0.4321472685365301,    0.7821684431180708,    0.4321472685365301),\n                new Grad4( 0.508629699630796,    -0.044802370851755174,  0.8586508742123365,   -0.044802370851755174),\n                new Grad4( 0.4321472685365301,   -0.12128480194602098,   0.7821684431180708,    0.4321472685365301),\n                new Grad4( 0.4321472685365301,    0.4321472685365301,    0.7821684431180708,   -0.12128480194602098),\n                new Grad4( 0.37968289875261624,   0.37968289875261624,   0.753341017856078,     0.37968289875261624),\n                new Grad4( 0.03381941603233842,   0.9982828964265062,    0.03381941603233842,   0.03381941603233842),\n                new Grad4(-0.044802370851755174,  0.8586508742123365,   -0.044802370851755174,  0.508629699630796),\n                new Grad4(-0.044802370851755174,  0.8586508742123365,    0.508629699630796,    -0.044802370851755174),\n                new Grad4(-0.12128480194602098,   0.7821684431180708,    0.4321472685365301,    0.4321472685365301),\n                new Grad4( 0.508629699630796,     0.8586508742123365,   -0.044802370851755174, -0.044802370851755174),\n                new Grad4( 0.4321472685365301,    0.7821684431180708,   -0.12128480194602098,   0.4321472685365301),\n                new Grad4( 0.4321472685365301,    0.7821684431180708,    0.4321472685365301,   -0.12128480194602098),\n                new Grad4( 0.37968289875261624,   0.753341017856078,     0.37968289875261624,   0.37968289875261624),\n                new Grad4( 0.9982828964265062,    0.03381941603233842,   0.03381941603233842,   0.03381941603233842),\n                new Grad4( 0.8586508742123365,   -0.044802370851755174, -0.044802370851755174,  0.508629699630796),\n                new Grad4( 0.8586508742123365,   -0.044802370851755174,  0.508629699630796,    -0.044802370851755174),\n                new Grad4( 0.7821684431180708,   -0.12128480194602098,   0.4321472685365301,    0.4321472685365301),\n                new Grad4( 0.8586508742123365,    0.508629699630796,    -0.044802370851755174, -0.044802370851755174),\n                new Grad4( 0.7821684431180708,    0.4321472685365301,   -0.12128480194602098,   0.4321472685365301),\n                new Grad4( 0.7821684431180708,    0.4321472685365301,    0.4321472685365301,   -0.12128480194602098),\n                new Grad4( 0.753341017856078,     0.37968289875261624,   0.37968289875261624,   0.37968289875261624)\n            };\n            for (int i = 0; i < grad4.Length; i++)\n            {\n                grad4[i].dx /= N4; grad4[i].dy /= N4; grad4[i].dz /= N4; grad4[i].dw /= N4;\n            }\n            for (int i = 0; i < PSIZE; i++)\n            {\n                gradients4D[i] = grad4[i % grad4.Length];\n            }\n\n            var base2D = new int[][]\n            {\n                new int[] { 1, 1, 0, 1, 0, 1, 0, 0, 0 },\n                new int[] { 1, 1, 0, 1, 0, 1, 2, 1, 1 }\n            };\n            var p2D = new int[] { 0, 0, 1, -1, 0, 0, -1, 1, 0, 2, 1, 1, 1, 2, 2, 0, 1, 2, 0, 2, 1, 0, 0, 0 };\n            var lookupPairs2D = new int[] { 0, 1, 1, 0, 4, 1, 17, 0, 20, 2, 21, 2, 22, 5, 23, 5, 26, 4, 39, 3, 42, 4, 43, 3 };\n\n            var contributions2D = new Contribution2[p2D.Length / 4];\n            for (int i = 0; i < p2D.Length; i += 4)\n            {\n                var baseSet = base2D[p2D[i]];\n                Contribution2 previous = null, current = null;\n                for (int k = 0; k < baseSet.Length; k += 3)\n                {\n                    current = new Contribution2(baseSet[k], baseSet[k + 1], baseSet[k + 2]);\n                    if (previous == null)\n                    {\n                        contributions2D[i / 4] = current;\n                    }\n                    else\n                    {\n                        previous.Next = current;\n                    }\n                    previous = current;\n                }\n                current.Next = new Contribution2(p2D[i + 1], p2D[i + 2], p2D[i + 3]);\n            }\n\n            lookup2D = new Contribution2[64];\n            for (var i = 0; i < lookupPairs2D.Length; i += 2)\n            {\n                lookup2D[lookupPairs2D[i]] = contributions2D[lookupPairs2D[i + 1]];\n            }\n\n            var base3D = new int[][]\n            {\n                new int[] { 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1 },\n                new int[] { 2, 1, 1, 0, 2, 1, 0, 1, 2, 0, 1, 1, 3, 1, 1, 1 },\n                new int[] { 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 2, 1, 1, 0, 2, 1, 0, 1, 2, 0, 1, 1 }\n            };\n            var p3D = new int[] { 0, 0, 1, -1, 0, 0, 1, 0, -1, 0, 0, -1, 1, 0, 0, 0, 1, -1, 0, 0, -1, 0, 1, 0, 0, -1, 1, 0, 2, 1, 1, 0, 1, 1, 1, -1, 0, 2, 1, 0, 1, 1, 1, -1, 1, 0, 2, 0, 1, 1, 1, -1, 1, 1, 1, 3, 2, 1, 0, 3, 1, 2, 0, 1, 3, 2, 0, 1, 3, 1, 0, 2, 1, 3, 0, 2, 1, 3, 0, 1, 2, 1, 1, 1, 0, 0, 2, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 2, 0, 1, 1, 0, 0, 1, 2, 0, 0, 2, 2, 0, 0, 0, 0, 1, 1, -1, 1, 2, 0, 0, 0, 0, 1, -1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, -1, 2, 3, 1, 1, 1, 2, 0, 0, 2, 2, 3, 1, 1, 1, 2, 2, 0, 0, 2, 3, 1, 1, 1, 2, 0, 2, 0, 2, 1, 1, -1, 1, 2, 0, 0, 2, 2, 1, 1, -1, 1, 2, 2, 0, 0, 2, 1, -1, 1, 1, 2, 0, 0, 2, 2, 1, -1, 1, 1, 2, 0, 2, 0, 2, 1, 1, 1, -1, 2, 2, 0, 0, 2, 1, 1, 1, -1, 2, 0, 2, 0 };\n            var lookupPairs3D = new int[] { 0, 2, 1, 1, 2, 2, 5, 1, 6, 0, 7, 0, 32, 2, 34, 2, 129, 1, 133, 1, 160, 5, 161, 5, 518, 0, 519, 0, 546, 4, 550, 4, 645, 3, 647, 3, 672, 5, 673, 5, 674, 4, 677, 3, 678, 4, 679, 3, 680, 13, 681, 13, 682, 12, 685, 14, 686, 12, 687, 14, 712, 20, 714, 18, 809, 21, 813, 23, 840, 20, 841, 21, 1198, 19, 1199, 22, 1226, 18, 1230, 19, 1325, 23, 1327, 22, 1352, 15, 1353, 17, 1354, 15, 1357, 17, 1358, 16, 1359, 16, 1360, 11, 1361, 10, 1362, 11, 1365, 10, 1366, 9, 1367, 9, 1392, 11, 1394, 11, 1489, 10, 1493, 10, 1520, 8, 1521, 8, 1878, 9, 1879, 9, 1906, 7, 1910, 7, 2005, 6, 2007, 6, 2032, 8, 2033, 8, 2034, 7, 2037, 6, 2038, 7, 2039, 6 };\n\n            var contributions3D = new Contribution3[p3D.Length / 9];\n            for (int i = 0; i < p3D.Length; i += 9)\n            {\n                var baseSet = base3D[p3D[i]];\n                Contribution3 previous = null, current = null;\n                for (int k = 0; k < baseSet.Length; k += 4)\n                {\n                    current = new Contribution3(baseSet[k], baseSet[k + 1], baseSet[k + 2], baseSet[k + 3]);\n                    if (previous == null)\n                    {\n                        contributions3D[i / 9] = current;\n                    }\n                    else\n                    {\n                        previous.Next = current;\n                    }\n                    previous = current;\n                }\n                current.Next = new Contribution3(p3D[i + 1], p3D[i + 2], p3D[i + 3], p3D[i + 4]);\n                current.Next.Next = new Contribution3(p3D[i + 5], p3D[i + 6], p3D[i + 7], p3D[i + 8]);\n            }\n\n            lookup3D = new Contribution3[2048];\n            for (var i = 0; i < lookupPairs3D.Length; i += 2)\n            {\n                lookup3D[lookupPairs3D[i]] = contributions3D[lookupPairs3D[i + 1]];\n            }\n\n            var base4D = new int[][]\n            {\n                new int[] { 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1 },\n                new int[] { 3, 1, 1, 1, 0, 3, 1, 1, 0, 1, 3, 1, 0, 1, 1, 3, 0, 1, 1, 1, 4, 1, 1, 1, 1 },\n                new int[] { 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 2, 1, 1, 0, 0, 2, 1, 0, 1, 0, 2, 1, 0, 0, 1, 2, 0, 1, 1, 0, 2, 0, 1, 0, 1, 2, 0, 0, 1, 1 },\n                new int[] { 3, 1, 1, 1, 0, 3, 1, 1, 0, 1, 3, 1, 0, 1, 1, 3, 0, 1, 1, 1, 2, 1, 1, 0, 0, 2, 1, 0, 1, 0, 2, 1, 0, 0, 1, 2, 0, 1, 1, 0, 2, 0, 1, 0, 1, 2, 0, 0, 1, 1 }\n            };\n            var p4D = new int[] { 0, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 1, 0, 0, 0, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 0, -1, 0, 1, 0, 0, 0, -1, 1, 0, 0, 0, 0, 1, -1, 0, 0, -1, 0, 0, 1, 0, 0, -1, 0, 1, 0, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0, 1, 1, 1, -1, 0, 1, 1, 1, 0, -1, 0, 2, 1, 0, 1, 0, 1, 1, -1, 1, 0, 1, 1, 0, 1, -1, 0, 2, 0, 1, 1, 0, 1, -1, 1, 1, 0, 1, 0, 1, 1, -1, 0, 2, 1, 0, 0, 1, 1, 1, -1, 0, 1, 1, 1, 0, -1, 1, 0, 2, 0, 1, 0, 1, 1, -1, 1, 0, 1, 1, 0, 1, -1, 1, 0, 2, 0, 0, 1, 1, 1, -1, 0, 1, 1, 1, 0, -1, 1, 1, 1, 4, 2, 1, 1, 0, 4, 1, 2, 1, 0, 4, 1, 1, 2, 0, 1, 4, 2, 1, 0, 1, 4, 1, 2, 0, 1, 4, 1, 1, 0, 2, 1, 4, 2, 0, 1, 1, 4, 1, 0, 2, 1, 4, 1, 0, 1, 2, 1, 4, 0, 2, 1, 1, 4, 0, 1, 2, 1, 4, 0, 1, 1, 2, 1, 2, 1, 1, 0, 0, 3, 2, 1, 0, 0, 3, 1, 2, 0, 0, 1, 2, 1, 0, 1, 0, 3, 2, 0, 1, 0, 3, 1, 0, 2, 0, 1, 2, 0, 1, 1, 0, 3, 0, 2, 1, 0, 3, 0, 1, 2, 0, 1, 2, 1, 0, 0, 1, 3, 2, 0, 0, 1, 3, 1, 0, 0, 2, 1, 2, 0, 1, 0, 1, 3, 0, 2, 0, 1, 3, 0, 1, 0, 2, 1, 2, 0, 0, 1, 1, 3, 0, 0, 2, 1, 3, 0, 0, 1, 2, 2, 3, 1, 1, 1, 0, 2, 1, 1, 1, -1, 2, 2, 0, 0, 0, 2, 3, 1, 1, 0, 1, 2, 1, 1, -1, 1, 2, 2, 0, 0, 0, 2, 3, 1, 0, 1, 1, 2, 1, -1, 1, 1, 2, 2, 0, 0, 0, 2, 3, 1, 1, 1, 0, 2, 1, 1, 1, -1, 2, 0, 2, 0, 0, 2, 3, 1, 1, 0, 1, 2, 1, 1, -1, 1, 2, 0, 2, 0, 0, 2, 3, 0, 1, 1, 1, 2, -1, 1, 1, 1, 2, 0, 2, 0, 0, 2, 3, 1, 1, 1, 0, 2, 1, 1, 1, -1, 2, 0, 0, 2, 0, 2, 3, 1, 0, 1, 1, 2, 1, -1, 1, 1, 2, 0, 0, 2, 0, 2, 3, 0, 1, 1, 1, 2, -1, 1, 1, 1, 2, 0, 0, 2, 0, 2, 3, 1, 1, 0, 1, 2, 1, 1, -1, 1, 2, 0, 0, 0, 2, 2, 3, 1, 0, 1, 1, 2, 1, -1, 1, 1, 2, 0, 0, 0, 2, 2, 3, 0, 1, 1, 1, 2, -1, 1, 1, 1, 2, 0, 0, 0, 2, 2, 1, 1, 1, -1, 0, 1, 1, 1, 0, -1, 0, 0, 0, 0, 0, 2, 1, 1, -1, 1, 0, 1, 1, 0, 1, -1, 0, 0, 0, 0, 0, 2, 1, -1, 1, 1, 0, 1, 0, 1, 1, -1, 0, 0, 0, 0, 0, 2, 1, 1, -1, 0, 1, 1, 1, 0, -1, 1, 0, 0, 0, 0, 0, 2, 1, -1, 1, 0, 1, 1, 0, 1, -1, 1, 0, 0, 0, 0, 0, 2, 1, -1, 0, 1, 1, 1, 0, -1, 1, 1, 0, 0, 0, 0, 0, 2, 1, 1, 1, -1, 0, 1, 1, 1, 0, -1, 2, 2, 0, 0, 0, 2, 1, 1, -1, 1, 0, 1, 1, 0, 1, -1, 2, 2, 0, 0, 0, 2, 1, 1, -1, 0, 1, 1, 1, 0, -1, 1, 2, 2, 0, 0, 0, 2, 1, 1, 1, -1, 0, 1, 1, 1, 0, -1, 2, 0, 2, 0, 0, 2, 1, -1, 1, 1, 0, 1, 0, 1, 1, -1, 2, 0, 2, 0, 0, 2, 1, -1, 1, 0, 1, 1, 0, 1, -1, 1, 2, 0, 2, 0, 0, 2, 1, 1, -1, 1, 0, 1, 1, 0, 1, -1, 2, 0, 0, 2, 0, 2, 1, -1, 1, 1, 0, 1, 0, 1, 1, -1, 2, 0, 0, 2, 0, 2, 1, -1, 0, 1, 1, 1, 0, -1, 1, 1, 2, 0, 0, 2, 0, 2, 1, 1, -1, 0, 1, 1, 1, 0, -1, 1, 2, 0, 0, 0, 2, 2, 1, -1, 1, 0, 1, 1, 0, 1, -1, 1, 2, 0, 0, 0, 2, 2, 1, -1, 0, 1, 1, 1, 0, -1, 1, 1, 2, 0, 0, 0, 2, 3, 1, 1, 0, 0, 0, 2, 2, 0, 0, 0, 2, 1, 1, 1, -1, 3, 1, 0, 1, 0, 0, 2, 0, 2, 0, 0, 2, 1, 1, 1, -1, 3, 1, 0, 0, 1, 0, 2, 0, 0, 2, 0, 2, 1, 1, 1, -1, 3, 1, 1, 0, 0, 0, 2, 2, 0, 0, 0, 2, 1, 1, -1, 1, 3, 1, 0, 1, 0, 0, 2, 0, 2, 0, 0, 2, 1, 1, -1, 1, 3, 1, 0, 0, 0, 1, 2, 0, 0, 0, 2, 2, 1, 1, -1, 1, 3, 1, 1, 0, 0, 0, 2, 2, 0, 0, 0, 2, 1, -1, 1, 1, 3, 1, 0, 0, 1, 0, 2, 0, 0, 2, 0, 2, 1, -1, 1, 1, 3, 1, 0, 0, 0, 1, 2, 0, 0, 0, 2, 2, 1, -1, 1, 1, 3, 1, 0, 1, 0, 0, 2, 0, 2, 0, 0, 2, -1, 1, 1, 1, 3, 1, 0, 0, 1, 0, 2, 0, 0, 2, 0, 2, -1, 1, 1, 1, 3, 1, 0, 0, 0, 1, 2, 0, 0, 0, 2, 2, -1, 1, 1, 1, 3, 3, 2, 1, 0, 0, 3, 1, 2, 0, 0, 4, 1, 1, 1, 1, 3, 3, 2, 0, 1, 0, 3, 1, 0, 2, 0, 4, 1, 1, 1, 1, 3, 3, 0, 2, 1, 0, 3, 0, 1, 2, 0, 4, 1, 1, 1, 1, 3, 3, 2, 0, 0, 1, 3, 1, 0, 0, 2, 4, 1, 1, 1, 1, 3, 3, 0, 2, 0, 1, 3, 0, 1, 0, 2, 4, 1, 1, 1, 1, 3, 3, 0, 0, 2, 1, 3, 0, 0, 1, 2, 4, 1, 1, 1, 1, 3, 3, 2, 1, 0, 0, 3, 1, 2, 0, 0, 2, 1, 1, 1, -1, 3, 3, 2, 0, 1, 0, 3, 1, 0, 2, 0, 2, 1, 1, 1, -1, 3, 3, 0, 2, 1, 0, 3, 0, 1, 2, 0, 2, 1, 1, 1, -1, 3, 3, 2, 1, 0, 0, 3, 1, 2, 0, 0, 2, 1, 1, -1, 1, 3, 3, 2, 0, 0, 1, 3, 1, 0, 0, 2, 2, 1, 1, -1, 1, 3, 3, 0, 2, 0, 1, 3, 0, 1, 0, 2, 2, 1, 1, -1, 1, 3, 3, 2, 0, 1, 0, 3, 1, 0, 2, 0, 2, 1, -1, 1, 1, 3, 3, 2, 0, 0, 1, 3, 1, 0, 0, 2, 2, 1, -1, 1, 1, 3, 3, 0, 0, 2, 1, 3, 0, 0, 1, 2, 2, 1, -1, 1, 1, 3, 3, 0, 2, 1, 0, 3, 0, 1, 2, 0, 2, -1, 1, 1, 1, 3, 3, 0, 2, 0, 1, 3, 0, 1, 0, 2, 2, -1, 1, 1, 1, 3, 3, 0, 0, 2, 1, 3, 0, 0, 1, 2, 2, -1, 1, 1, 1 };\n            var lookupPairs4D = new int[] { 0, 3, 1, 2, 2, 3, 5, 2, 6, 1, 7, 1, 8, 3, 9, 2, 10, 3, 13, 2, 16, 3, 18, 3, 22, 1, 23, 1, 24, 3, 26, 3, 33, 2, 37, 2, 38, 1, 39, 1, 41, 2, 45, 2, 54, 1, 55, 1, 56, 0, 57, 0, 58, 0, 59, 0, 60, 0, 61, 0, 62, 0, 63, 0, 256, 3, 258, 3, 264, 3, 266, 3, 272, 3, 274, 3, 280, 3, 282, 3, 2049, 2, 2053, 2, 2057, 2, 2061, 2, 2081, 2, 2085, 2, 2089, 2, 2093, 2, 2304, 9, 2305, 9, 2312, 9, 2313, 9, 16390, 1, 16391, 1, 16406, 1, 16407, 1, 16422, 1, 16423, 1, 16438, 1, 16439, 1, 16642, 8, 16646, 8, 16658, 8, 16662, 8, 18437, 6, 18439, 6, 18469, 6, 18471, 6, 18688, 9, 18689, 9, 18690, 8, 18693, 6, 18694, 8, 18695, 6, 18696, 9, 18697, 9, 18706, 8, 18710, 8, 18725, 6, 18727, 6, 131128, 0, 131129, 0, 131130, 0, 131131, 0, 131132, 0, 131133, 0, 131134, 0, 131135, 0, 131352, 7, 131354, 7, 131384, 7, 131386, 7, 133161, 5, 133165, 5, 133177, 5, 133181, 5, 133376, 9, 133377, 9, 133384, 9, 133385, 9, 133400, 7, 133402, 7, 133417, 5, 133421, 5, 133432, 7, 133433, 5, 133434, 7, 133437, 5, 147510, 4, 147511, 4, 147518, 4, 147519, 4, 147714, 8, 147718, 8, 147730, 8, 147734, 8, 147736, 7, 147738, 7, 147766, 4, 147767, 4, 147768, 7, 147770, 7, 147774, 4, 147775, 4, 149509, 6, 149511, 6, 149541, 6, 149543, 6, 149545, 5, 149549, 5, 149558, 4, 149559, 4, 149561, 5, 149565, 5, 149566, 4, 149567, 4, 149760, 9, 149761, 9, 149762, 8, 149765, 6, 149766, 8, 149767, 6, 149768, 9, 149769, 9, 149778, 8, 149782, 8, 149784, 7, 149786, 7, 149797, 6, 149799, 6, 149801, 5, 149805, 5, 149814, 4, 149815, 4, 149816, 7, 149817, 5, 149818, 7, 149821, 5, 149822, 4, 149823, 4, 149824, 37, 149825, 37, 149826, 36, 149829, 34, 149830, 36, 149831, 34, 149832, 37, 149833, 37, 149842, 36, 149846, 36, 149848, 35, 149850, 35, 149861, 34, 149863, 34, 149865, 33, 149869, 33, 149878, 32, 149879, 32, 149880, 35, 149881, 33, 149882, 35, 149885, 33, 149886, 32, 149887, 32, 150080, 49, 150082, 48, 150088, 49, 150098, 48, 150104, 47, 150106, 47, 151873, 46, 151877, 45, 151881, 46, 151909, 45, 151913, 44, 151917, 44, 152128, 49, 152129, 46, 152136, 49, 152137, 46, 166214, 43, 166215, 42, 166230, 43, 166247, 42, 166262, 41, 166263, 41, 166466, 48, 166470, 43, 166482, 48, 166486, 43, 168261, 45, 168263, 42, 168293, 45, 168295, 42, 168512, 31, 168513, 28, 168514, 31, 168517, 28, 168518, 25, 168519, 25, 280952, 40, 280953, 39, 280954, 40, 280957, 39, 280958, 38, 280959, 38, 281176, 47, 281178, 47, 281208, 40, 281210, 40, 282985, 44, 282989, 44, 283001, 39, 283005, 39, 283208, 30, 283209, 27, 283224, 30, 283241, 27, 283256, 22, 283257, 22, 297334, 41, 297335, 41, 297342, 38, 297343, 38, 297554, 29, 297558, 24, 297562, 29, 297590, 24, 297594, 21, 297598, 21, 299365, 26, 299367, 23, 299373, 26, 299383, 23, 299389, 20, 299391, 20, 299584, 31, 299585, 28, 299586, 31, 299589, 28, 299590, 25, 299591, 25, 299592, 30, 299593, 27, 299602, 29, 299606, 24, 299608, 30, 299610, 29, 299621, 26, 299623, 23, 299625, 27, 299629, 26, 299638, 24, 299639, 23, 299640, 22, 299641, 22, 299642, 21, 299645, 20, 299646, 21, 299647, 20, 299648, 61, 299649, 60, 299650, 61, 299653, 60, 299654, 59, 299655, 59, 299656, 58, 299657, 57, 299666, 55, 299670, 54, 299672, 58, 299674, 55, 299685, 52, 299687, 51, 299689, 57, 299693, 52, 299702, 54, 299703, 51, 299704, 56, 299705, 56, 299706, 53, 299709, 50, 299710, 53, 299711, 50, 299904, 61, 299906, 61, 299912, 58, 299922, 55, 299928, 58, 299930, 55, 301697, 60, 301701, 60, 301705, 57, 301733, 52, 301737, 57, 301741, 52, 301952, 79, 301953, 79, 301960, 76, 301961, 76, 316038, 59, 316039, 59, 316054, 54, 316071, 51, 316086, 54, 316087, 51, 316290, 78, 316294, 78, 316306, 73, 316310, 73, 318085, 77, 318087, 77, 318117, 70, 318119, 70, 318336, 79, 318337, 79, 318338, 78, 318341, 77, 318342, 78, 318343, 77, 430776, 56, 430777, 56, 430778, 53, 430781, 50, 430782, 53, 430783, 50, 431000, 75, 431002, 72, 431032, 75, 431034, 72, 432809, 74, 432813, 69, 432825, 74, 432829, 69, 433032, 76, 433033, 76, 433048, 75, 433065, 74, 433080, 75, 433081, 74, 447158, 71, 447159, 68, 447166, 71, 447167, 68, 447378, 73, 447382, 73, 447386, 72, 447414, 71, 447418, 72, 447422, 71, 449189, 70, 449191, 70, 449197, 69, 449207, 68, 449213, 69, 449215, 68, 449408, 67, 449409, 67, 449410, 66, 449413, 64, 449414, 66, 449415, 64, 449416, 67, 449417, 67, 449426, 66, 449430, 66, 449432, 65, 449434, 65, 449445, 64, 449447, 64, 449449, 63, 449453, 63, 449462, 62, 449463, 62, 449464, 65, 449465, 63, 449466, 65, 449469, 63, 449470, 62, 449471, 62, 449472, 19, 449473, 19, 449474, 18, 449477, 16, 449478, 18, 449479, 16, 449480, 19, 449481, 19, 449490, 18, 449494, 18, 449496, 17, 449498, 17, 449509, 16, 449511, 16, 449513, 15, 449517, 15, 449526, 14, 449527, 14, 449528, 17, 449529, 15, 449530, 17, 449533, 15, 449534, 14, 449535, 14, 449728, 19, 449729, 19, 449730, 18, 449734, 18, 449736, 19, 449737, 19, 449746, 18, 449750, 18, 449752, 17, 449754, 17, 449784, 17, 449786, 17, 451520, 19, 451521, 19, 451525, 16, 451527, 16, 451528, 19, 451529, 19, 451557, 16, 451559, 16, 451561, 15, 451565, 15, 451577, 15, 451581, 15, 451776, 19, 451777, 19, 451784, 19, 451785, 19, 465858, 18, 465861, 16, 465862, 18, 465863, 16, 465874, 18, 465878, 18, 465893, 16, 465895, 16, 465910, 14, 465911, 14, 465918, 14, 465919, 14, 466114, 18, 466118, 18, 466130, 18, 466134, 18, 467909, 16, 467911, 16, 467941, 16, 467943, 16, 468160, 13, 468161, 13, 468162, 13, 468163, 13, 468164, 13, 468165, 13, 468166, 13, 468167, 13, 580568, 17, 580570, 17, 580585, 15, 580589, 15, 580598, 14, 580599, 14, 580600, 17, 580601, 15, 580602, 17, 580605, 15, 580606, 14, 580607, 14, 580824, 17, 580826, 17, 580856, 17, 580858, 17, 582633, 15, 582637, 15, 582649, 15, 582653, 15, 582856, 12, 582857, 12, 582872, 12, 582873, 12, 582888, 12, 582889, 12, 582904, 12, 582905, 12, 596982, 14, 596983, 14, 596990, 14, 596991, 14, 597202, 11, 597206, 11, 597210, 11, 597214, 11, 597234, 11, 597238, 11, 597242, 11, 597246, 11, 599013, 10, 599015, 10, 599021, 10, 599023, 10, 599029, 10, 599031, 10, 599037, 10, 599039, 10, 599232, 13, 599233, 13, 599234, 13, 599235, 13, 599236, 13, 599237, 13, 599238, 13, 599239, 13, 599240, 12, 599241, 12, 599250, 11, 599254, 11, 599256, 12, 599257, 12, 599258, 11, 599262, 11, 599269, 10, 599271, 10, 599272, 12, 599273, 12, 599277, 10, 599279, 10, 599282, 11, 599285, 10, 599286, 11, 599287, 10, 599288, 12, 599289, 12, 599290, 11, 599293, 10, 599294, 11, 599295, 10 };\n            var contributions4D = new Contribution4[p4D.Length / 16];\n            for (int i = 0; i < p4D.Length; i += 16)\n            {\n                var baseSet = base4D[p4D[i]];\n                Contribution4 previous = null, current = null;\n                for (int k = 0; k < baseSet.Length; k += 5)\n                {\n                    current = new Contribution4(baseSet[k], baseSet[k + 1], baseSet[k + 2], baseSet[k + 3], baseSet[k + 4]);\n                    if (previous == null)\n                    {\n                        contributions4D[i / 16] = current;\n                    }\n                    else\n                    {\n                        previous.Next = current;\n                    }\n                    previous = current;\n                }\n                current.Next = new Contribution4(p4D[i + 1], p4D[i + 2], p4D[i + 3], p4D[i + 4], p4D[i + 5]);\n                current.Next.Next = new Contribution4(p4D[i + 6], p4D[i + 7], p4D[i + 8], p4D[i + 9], p4D[i + 10]);\n                current.Next.Next.Next = new Contribution4(p4D[i + 11], p4D[i + 12], p4D[i + 13], p4D[i + 14], p4D[i + 15]);\n            }\n\n            lookup4D = new Contribution4[1048576];\n            for (var i = 0; i < lookupPairs4D.Length; i += 2)\n            {\n                lookup4D[lookupPairs4D[i]] = contributions4D[lookupPairs4D[i + 1]];\n            }\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        private static int FastFloor(double x)\n        {\n            var xi = (int)x;\n            return x < xi ? xi - 1 : xi;\n        }\n\n        public OpenSimplex()\n            : this(DateTime.Now.Ticks)\n        {\n        }\n\n        public OpenSimplex(long seed)\n        {\n            perm = new short[PSIZE];\n            permGrad2 = new Grad2[PSIZE];\n            permGrad3 = new Grad3[PSIZE];\n            permGrad4 = new Grad4[PSIZE];\n            var source = new short[PSIZE];\n            for (int i = 0; i < PSIZE; i++)\n            {\n                source[i] = (short)i;\n            }\n            for (int i = PSIZE - 1; i >= 0; i--)\n            {\n                seed = seed * 6364136223846793005L + 1442695040888963407L;\n                int r = (int)((seed + 31) % (i + 1));\n                if (r < 0)\n                {\n                    r += (i + 1);\n                }\n                perm[i] = source[r];\n                permGrad2[i] = gradients2D[perm[i]];\n                permGrad3[i] = gradients3D[perm[i]];\n                permGrad4[i] = gradients4D[perm[i]];\n                source[r] = source[i];\n            }\n        }\n\n        public double Evaluate(double x, double y)\n        {\n            var stretchOffset = (x + y) * STRETCH_2D;\n            var xs = x + stretchOffset;\n            var ys = y + stretchOffset;\n\n            var xsb = FastFloor(xs);\n            var ysb = FastFloor(ys);\n\n            var xins = xs - xsb;\n            var yins = ys - ysb;\n\n            var inSum = xins + yins;\n\n            var squishOffsetIns = inSum * SQUISH_2D;\n            var dx0 = xins + squishOffsetIns;\n            var dy0 = yins + squishOffsetIns;\n\n            var hash =\n               (int)(xins - yins + 1) |\n               (int)(inSum) << 1 |\n               (int)(inSum + yins) << 2 |\n               (int)(inSum + xins) << 4;\n\n            var c = lookup2D[hash];\n\n            var value = 0.0;\n            while (c != null)\n            {\n                var dx = dx0 + c.dx;\n                var dy = dy0 + c.dy;\n                var attn = 2 - dx * dx - dy * dy;\n                if (attn > 0)\n                {\n                    var px = xsb + c.xsb;\n                    var py = ysb + c.ysb;\n\n                    Grad2 grad = permGrad2[perm[px & PMASK] ^ (py & PMASK)];\n                    var valuePart = grad.dx * dx + grad.dy * dy;\n\n                    attn *= attn;\n                    value += attn * attn * valuePart;\n                }\n                c = c.Next;\n            }\n            return value;\n        }\n\n        public double Evaluate(double x, double y, double z)\n        {\n            var stretchOffset = (x + y + z) * STRETCH_3D;\n            var xs = x + stretchOffset;\n            var ys = y + stretchOffset;\n            var zs = z + stretchOffset;\n\n            return evaluate3_Base(xs, ys, zs);\n        }\n\n        // Not as good as in SuperSimplex/OpenSimplex2S, since there are more visible differences between different slices.\n        // The Z coordinate should always be the \"different\" coordinate in your use case.\n        public double Evaluate3_XYBeforeZ(double x, double y, double z)\n        {\n            // Combine rotation with skew transform.\n            var xy = x + y;\n            var s2 = xy * 0.211324865405187;\n            var zz = z * 0.288675134594813;\n            double xs = s2 - x + zz, ys = s2 - y + zz;\n            double zs = xy * 0.577350269189626 + zz;\n\n            return evaluate3_Base(xs, ys, zs);\n        }\n\n        // Similar to the above, except the Y coordinate should always be the \"different\" coordinate in your use case.\n        public double Evaluate3_XZBeforeY(double x, double y, double z)\n        {\n            // Combine rotation with skew transform.\n            var xz = x + z;\n            var s2 = xz * 0.211324865405187;\n            var yy = y * 0.288675134594813;\n            double xs = s2 - x + yy, zs = s2 - z + yy;\n            double ys = xz * 0.577350269189626 + yy;\n\n            return evaluate3_Base(xs, ys, zs);\n        }\n\n        private double evaluate3_Base(double xs, double ys, double zs)\n        {\n            var xsb = FastFloor(xs);\n            var ysb = FastFloor(ys);\n            var zsb = FastFloor(zs);\n\n            var xins = xs - xsb;\n            var yins = ys - ysb;\n            var zins = zs - zsb;\n\n            var inSum = xins + yins + zins;\n\n            var squishOffsetIns = inSum * SQUISH_3D;\n            var dx0 = xins + squishOffsetIns;\n            var dy0 = yins + squishOffsetIns;\n            var dz0 = zins + squishOffsetIns;\n\n            var hash =\n               (int)(yins - zins + 1) |\n               (int)(xins - yins + 1) << 1 |\n               (int)(xins - zins + 1) << 2 |\n               (int)inSum << 3 |\n               (int)(inSum + zins) << 5 |\n               (int)(inSum + yins) << 7 |\n               (int)(inSum + xins) << 9;\n\n            var c = lookup3D[hash];\n\n            var value = 0.0;\n            while (c != null)\n            {\n                var dx = dx0 + c.dx;\n                var dy = dy0 + c.dy;\n                var dz = dz0 + c.dz;\n                var attn = 2 - dx * dx - dy * dy - dz * dz;\n                if (attn > 0)\n                {\n                    var px = xsb + c.xsb;\n                    var py = ysb + c.ysb;\n                    var pz = zsb + c.zsb;\n\n                    Grad3 grad = permGrad3[perm[perm[px & PMASK] ^ (py & PMASK)] ^ (pz & PMASK)];\n                    var valuePart = grad.dx * dx + grad.dy * dy + grad.dz * dz;\n\n                    attn *= attn;\n                    value += attn * attn * valuePart;\n                }\n\n                c = c.Next;\n            }\n            return value;\n        }\n\n        public double Evaluate(double x, double y, double z, double w)\n        {\n            var stretchOffset = (x + y + z + w) * STRETCH_4D;\n            var xs = x + stretchOffset;\n            var ys = y + stretchOffset;\n            var zs = z + stretchOffset;\n            var ws = w + stretchOffset;\n\n            var xsb = FastFloor(xs);\n            var ysb = FastFloor(ys);\n            var zsb = FastFloor(zs);\n            var wsb = FastFloor(ws);\n\n            var xins = xs - xsb;\n            var yins = ys - ysb;\n            var zins = zs - zsb;\n            var wins = ws - wsb;\n\n            var inSum = xins + yins + zins + wins;\n\n            var squishOffsetIns = inSum * SQUISH_4D;\n            var dx0 = xins + squishOffsetIns;\n            var dy0 = yins + squishOffsetIns;\n            var dz0 = zins + squishOffsetIns;\n            var dw0 = wins + squishOffsetIns;\n\n            var hash =\n                (int)(zins - wins + 1) |\n                (int)(yins - zins + 1) << 1 |\n                (int)(yins - wins + 1) << 2 |\n                (int)(xins - yins + 1) << 3 |\n                (int)(xins - zins + 1) << 4 |\n                (int)(xins - wins + 1) << 5 |\n                (int)inSum << 6 |\n                (int)(inSum + wins) << 8 |\n                (int)(inSum + zins) << 11 |\n                (int)(inSum + yins) << 14 |\n                (int)(inSum + xins) << 17;\n\n            var c = lookup4D[hash];\n\n            var value = 0.0;\n            while (c != null)\n            {\n                var dx = dx0 + c.dx;\n                var dy = dy0 + c.dy;\n                var dz = dz0 + c.dz;\n                var dw = dw0 + c.dw;\n                var attn = 2 - dx * dx - dy * dy - dz * dz - dw * dw;\n                if (attn > 0)\n                {\n                    var px = xsb + c.xsb;\n                    var py = ysb + c.ysb;\n                    var pz = zsb + c.zsb;\n                    var pw = wsb + c.wsb;\n\n                    Grad4 grad = permGrad4[perm[perm[perm[px & PMASK] ^ (py & PMASK)] ^ (pz & PMASK)] ^ (pw & PMASK)];\n                    var valuePart = grad.dx * dx + grad.dy * dy + grad.dz * dz + grad.dw * dw;\n\n                    attn *= attn;\n                    value += attn * attn * valuePart;\n                }\n\n                c = c.Next;\n            }\n            return value;\n        }\n\n        private class Contribution2\n        {\n            public double dx, dy;\n            public int xsb, ysb;\n            public Contribution2 Next;\n\n            public Contribution2(double multiplier, int xsb, int ysb)\n            {\n                dx = -xsb - multiplier * SQUISH_2D;\n                dy = -ysb - multiplier * SQUISH_2D;\n                this.xsb = xsb;\n                this.ysb = ysb;\n            }\n        }\n\n        private class Contribution3\n        {\n            public double dx, dy, dz;\n            public int xsb, ysb, zsb;\n            public Contribution3 Next;\n\n            public Contribution3(double multiplier, int xsb, int ysb, int zsb)\n            {\n                dx = -xsb - multiplier * SQUISH_3D;\n                dy = -ysb - multiplier * SQUISH_3D;\n                dz = -zsb - multiplier * SQUISH_3D;\n                this.xsb = xsb;\n                this.ysb = ysb;\n                this.zsb = zsb;\n            }\n        }\n\n        private class Contribution4\n        {\n            public double dx, dy, dz, dw;\n            public int xsb, ysb, zsb, wsb;\n            public Contribution4 Next;\n\n            public Contribution4(double multiplier, int xsb, int ysb, int zsb, int wsb)\n            {\n                dx = -xsb - multiplier * SQUISH_4D;\n                dy = -ysb - multiplier * SQUISH_4D;\n                dz = -zsb - multiplier * SQUISH_4D;\n                dw = -wsb - multiplier * SQUISH_4D;\n                this.xsb = xsb;\n                this.ysb = ysb;\n                this.zsb = zsb;\n                this.wsb = wsb;\n            }\n        }\n\n        public class Grad2\n        {\n            public double dx, dy;\n            public Grad2(double dx, double dy)\n            {\n                this.dx = dx;\n                this.dy = dy;\n            }\n        }\n\n        public class Grad3\n        {\n            public double dx, dy, dz;\n            public Grad3(double dx, double dy, double dz)\n            {\n                this.dx = dx;\n                this.dy = dy;\n                this.dz = dz;\n            }\n        }\n\n        public class Grad4\n        {\n            public double dx, dy, dz, dw;\n            public Grad4(double dx, double dy, double dz, double dw)\n            {\n                this.dx = dx;\n                this.dy = dy;\n                this.dz = dz;\n                this.dw = dw;\n            }\n        }\n    }\n}"
  },
  {
    "path": "_old/csharp/legacy/UNLICENSE",
    "content": "This is free and unencumbered software released into the public domain.\n\nAnyone is free to copy, modify, publish, use, compile, sell, or\ndistribute this software, either in source code form or as a compiled\nbinary, for any purpose, commercial or non-commercial, and by any\nmeans.\n\nIn jurisdictions that recognize copyright laws, the author or authors\nof this software dedicate any and all copyright interest in the\nsoftware to the public domain. We make this dedication for the benefit\nof the public at large and to the detriment of our heirs and\nsuccessors. We intend this dedication to be an overt act of\nrelinquishment in perpetuity of all present and future rights to this\nsoftware under copyright law.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR\nOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\nFor more information, please refer to <https://unlicense.org>\n"
  },
  {
    "path": "_old/java/OpenSimplex2F.java",
    "content": "/**\n * K.jpg's OpenSimplex 2, faster variant\n *\n * - 2D is standard simplex implemented using a lookup table.\n * - 3D is \"Re-oriented 4-point BCC noise\" which constructs a\n *   congruent BCC lattice in a much different way than usual.\n * - 4D constructs the lattice as a union of five copies of its\n *   reciprocal. It successively finds the closest point on each.\n *\n * Multiple versions of each function are provided. See the\n * documentation above each, for more info.\n */\npublic class OpenSimplex2F {\n\t\n\tprivate static final int PSIZE = 2048;\n\tprivate static final int PMASK = 2047;\n\n\tprivate short[] perm;\n\tprivate Grad2[] permGrad2;\n\tprivate Grad3[] permGrad3;\n\tprivate Grad4[] permGrad4;\n\n\tpublic OpenSimplex2F(long seed) {\n\t\tperm = new short[PSIZE];\n\t\tpermGrad2 = new Grad2[PSIZE];\n\t\tpermGrad3 = new Grad3[PSIZE];\n\t\tpermGrad4 = new Grad4[PSIZE];\n\t\tshort[] source = new short[PSIZE]; \n\t\tfor (short i = 0; i < PSIZE; i++)\n\t\t\tsource[i] = i;\n\t\tfor (int i = PSIZE - 1; i >= 0; i--) {\n\t\t\tseed = seed * 6364136223846793005L + 1442695040888963407L;\n\t\t\tint r = (int)((seed + 31) % (i + 1));\n\t\t\tif (r < 0)\n\t\t\t\tr += (i + 1);\n\t\t\tperm[i] = source[r];\n\t\t\tpermGrad2[i] = GRADIENTS_2D[perm[i]];\n\t\t\tpermGrad3[i] = GRADIENTS_3D[perm[i]];\n\t\t\tpermGrad4[i] = GRADIENTS_4D[perm[i]];\n\t\t\tsource[r] = source[i];\n\t\t}\n\t}\n\t\n\t/*\n\t * Noise Evaluators\n\t */\n\t\n\t/**\n\t * 2D Simplex noise, standard lattice orientation.\n\t */\n\tpublic double noise2(double x, double y) {\n\t\t\n\t\t// Get points for A2* lattice\n\t\tdouble s = 0.366025403784439 * (x + y);\n\t\tdouble xs = x + s, ys = y + s;\n\t\t\n\t\treturn noise2_Base(xs, ys);\n\t}\n\t\n\t/**\n\t * 2D Simplex noise, with Y pointing down the main diagonal.\n\t * Might be better for a 2D sandbox style game, where Y is vertical.\n\t * Probably slightly less optimal for heightmaps or continent maps.\n\t */\n\tpublic double noise2_XBeforeY(double x, double y) {\n\t\t\n\t\t// Skew transform and rotation baked into one.\n\t\tdouble xx = x * 0.7071067811865476;\n\t\tdouble yy = y * 1.224744871380249;\n\t\t\n\t\treturn noise2_Base(yy + xx, yy - xx);\n\t}\n\t\n\t/**\n\t * 2D Simplex noise base.\n\t * Lookup table implementation inspired by DigitalShadow.\n\t */\n\tprivate double noise2_Base(double xs, double ys) {\n\t\tdouble value = 0;\n\t\t\n\t\t// Get base points and offsets\n\t\tint xsb = fastFloor(xs), ysb = fastFloor(ys);\n\t\tdouble xsi = xs - xsb, ysi = ys - ysb;\n\t\t\n\t\t// Index to point list\n\t\tint index = (int)((ysi - xsi) / 2 + 1);\n\t\t\n\t\tdouble ssi = (xsi + ysi) * -0.211324865405187;\n\t\tdouble xi = xsi + ssi, yi = ysi + ssi;\n\n\t\t// Point contributions\n\t\tfor (int i = 0; i < 3; i++) {\n\t\t\tLatticePoint2D c = LOOKUP_2D[index + i];\n\n\t\t\tdouble dx = xi + c.dx, dy = yi + c.dy;\n\t\t\tdouble attn = 0.5 - dx * dx - dy * dy;\n\t\t\tif (attn <= 0) continue;\n\n\t\t\tint pxm = (xsb + c.xsv) & PMASK, pym = (ysb + c.ysv) & PMASK;\n\t\t\tGrad2 grad = permGrad2[perm[pxm] ^ pym];\n\t\t\tdouble extrapolation = grad.dx * dx + grad.dy * dy;\n\t\t\t\n\t\t\tattn *= attn;\n\t\t\tvalue += attn * attn * extrapolation;\n\t\t}\n\t\t\n\t\treturn value;\n\t}\n\t\n\t/**\n\t * 3D Re-oriented 4-point BCC noise, classic orientation.\n\t * Proper substitute for 3D Simplex in light of Forbidden Formulae.\n\t * Use noise3_XYBeforeZ or noise3_XZBeforeY instead, wherever appropriate.\n\t */\n\tpublic double noise3_Classic(double x, double y, double z) {\n\t\t\n\t\t// Re-orient the cubic lattices via rotation, to produce the expected look on cardinal planar slices.\n\t\t// If texturing objects that don't tend to have cardinal plane faces, you could even remove this.\n\t\t// Orthonormal rotation. Not a skew transform.\n\t\tdouble r = (2.0 / 3.0) * (x + y + z);\n\t\tdouble xr = r - x, yr = r - y, zr = r - z;\n\t\t\n\t\t// Evaluate both lattices to form a BCC lattice.\n\t\treturn noise3_BCC(xr, yr, zr);\n\t}\n\t\n\t/**\n\t * 3D Re-oriented 4-point BCC noise, with better visual isotropy in (X, Y).\n\t * Recommended for 3D terrain and time-varied animations.\n\t * The Z coordinate should always be the \"different\" coordinate in your use case.\n\t * If Y is vertical in world coordinates, call noise3_XYBeforeZ(x, z, Y) or use noise3_XZBeforeY.\n\t * If Z is vertical in world coordinates, call noise3_XYBeforeZ(x, y, Z).\n\t * For a time varied animation, call noise3_XYBeforeZ(x, y, T).\n\t */\n\tpublic double noise3_XYBeforeZ(double x, double y, double z) {\n\t\t\n\t\t// Re-orient the cubic lattices without skewing, to make X and Y triangular like 2D.\n\t\t// Orthonormal rotation. Not a skew transform.\n\t\tdouble xy = x + y;\n\t\tdouble s2 = xy * -0.211324865405187;\n\t\tdouble zz = z * 0.577350269189626;\n\t\tdouble xr = x + s2 - zz, yr = y + s2 - zz;\n\t\tdouble zr = xy * 0.577350269189626 + zz;\n\t\t\n\t\t// Evaluate both lattices to form a BCC lattice.\n\t\treturn noise3_BCC(xr, yr, zr);\n\t}\n\t\n\t/**\n\t * 3D Re-oriented 4-point BCC noise, with better visual isotropy in (X, Z).\n\t * Recommended for 3D terrain and time-varied animations.\n\t * The Y coordinate should always be the \"different\" coordinate in your use case.\n\t * If Y is vertical in world coordinates, call noise3_XZBeforeY(x, Y, z).\n\t * If Z is vertical in world coordinates, call noise3_XZBeforeY(x, Z, y) or use noise3_XYBeforeZ.\n\t * For a time varied animation, call noise3_XZBeforeY(x, T, y) or use noise3_XYBeforeZ.\n\t */\n\tpublic double noise3_XZBeforeY(double x, double y, double z) {\n\t\t\n\t\t// Re-orient the cubic lattices without skewing, to make X and Z triangular like 2D.\n\t\t// Orthonormal rotation. Not a skew transform.\n\t\tdouble xz = x + z;\n\t\tdouble s2 = xz * -0.211324865405187;\n\t\tdouble yy = y * 0.577350269189626;\n\t\tdouble xr = x + s2 - yy; double zr = z + s2 - yy;\n\t\tdouble yr = xz * 0.577350269189626 + yy;\n\t\t\n\t\t// Evaluate both lattices to form a BCC lattice.\n\t\treturn noise3_BCC(xr, yr, zr);\n\t}\n\t\n\t/**\n\t * Generate overlapping cubic lattices for 3D Re-oriented BCC noise.\n\t * Lookup table implementation inspired by DigitalShadow.\n\t * It was actually faster to narrow down the points in the loop itself,\n\t * than to build up the index with enough info to isolate 4 points.\n\t */\n\tprivate double noise3_BCC(double xr, double yr, double zr) {\n\t\t\n\t\t// Get base and offsets inside cube of first lattice.\n\t\tint xrb = fastFloor(xr), yrb = fastFloor(yr), zrb = fastFloor(zr);\n\t\tdouble xri = xr - xrb, yri = yr - yrb, zri = zr - zrb;\n\t\t\n\t\t// Identify which octant of the cube we're in. This determines which cell\n\t\t// in the other cubic lattice we're in, and also narrows down one point on each.\n\t\tint xht = (int)(xri + 0.5), yht = (int)(yri + 0.5), zht = (int)(zri + 0.5);\n\t\tint index = (xht << 0) | (yht << 1) | (zht << 2);\n\t\t\n\t\t// Point contributions\n\t\tdouble value = 0;\n\t\tLatticePoint3D c = LOOKUP_3D[index];\n\t\twhile (c != null) {\n\t\t\tdouble dxr = xri + c.dxr, dyr = yri + c.dyr, dzr = zri + c.dzr;\n\t\t\tdouble attn = 0.5 - dxr * dxr - dyr * dyr - dzr * dzr;\n\t\t\tif (attn < 0) {\n\t\t\t\tc = c.nextOnFailure;\n\t\t\t} else {\n\t\t\t\tint pxm = (xrb + c.xrv) & PMASK, pym = (yrb + c.yrv) & PMASK, pzm = (zrb + c.zrv) & PMASK;\n\t\t\t\tGrad3 grad = permGrad3[perm[perm[pxm] ^ pym] ^ pzm];\n\t\t\t\tdouble extrapolation = grad.dx * dxr + grad.dy * dyr + grad.dz * dzr;\n\t\t\t\t\n\t\t\t\tattn *= attn;\n\t\t\t\tvalue += attn * attn * extrapolation;\n\t\t\t\tc = c.nextOnSuccess;\n\t\t\t}\n\t\t}\n\t\treturn value;\n\t}\n\t\n\t/**\n\t * 4D OpenSimplex2F noise, classic lattice orientation.\n\t */\n\tpublic double noise4_Classic(double x, double y, double z, double w) {\n\t\t\n\t\t// Get points for A4 lattice\n\t\tdouble s = -0.138196601125011 * (x + y + z + w);\n\t\tdouble xs = x + s, ys = y + s, zs = z + s, ws = w + s;\n\t\t\n\t\treturn noise4_Base(xs, ys, zs, ws);\n\t}\n\t\n\t/**\n\t * 4D OpenSimplex2F noise, with XY and ZW forming orthogonal triangular-based planes.\n\t * Recommended for 3D terrain, where X and Y (or Z and W) are horizontal.\n\t * Recommended for noise(x, y, sin(time), cos(time)) trick.\n\t */\n\tpublic double noise4_XYBeforeZW(double x, double y, double z, double w) {\n\t\t\n\t\tdouble s2 = (x + y) * -0.178275657951399372 + (z + w) * 0.215623393288842828;\n\t\tdouble t2 = (z + w) * -0.403949762580207112 + (x + y) * -0.375199083010075342;\n\t\tdouble xs = x + s2, ys = y + s2, zs = z + t2, ws = w + t2;\n\t\t\n\t\treturn noise4_Base(xs, ys, zs, ws);\n\t}\n\t\n\t/**\n\t * 4D OpenSimplex2F noise, with XZ and YW forming orthogonal triangular-based planes.\n\t * Recommended for 3D terrain, where X and Z (or Y and W) are horizontal.\n\t */\n\tpublic double noise4_XZBeforeYW(double x, double y, double z, double w) {\n\t\t\n\t\tdouble s2 = (x + z) * -0.178275657951399372 + (y + w) * 0.215623393288842828;\n\t\tdouble t2 = (y + w) * -0.403949762580207112 + (x + z) * -0.375199083010075342;\n\t\tdouble xs = x + s2, ys = y + t2, zs = z + s2, ws = w + t2;\n\t\t\n\t\treturn noise4_Base(xs, ys, zs, ws);\n\t}\n\t\n\t/**\n\t * 4D OpenSimplex2F noise, with XYZ oriented like noise3_Classic,\n\t * and W for an extra degree of freedom. W repeats eventually.\n\t * Recommended for time-varied animations which texture a 3D object (W=time)\n\t */\n\tpublic double noise4_XYZBeforeW(double x, double y, double z, double w) {\n\t\t\n\t\tdouble xyz = x + y + z;\n\t\tdouble ww = w * 0.2236067977499788;\n\t\tdouble s2 = xyz * -0.16666666666666666 + ww;\n\t\tdouble xs = x + s2, ys = y + s2, zs = z + s2, ws = -0.5 * xyz + ww;\n\t\t\n\t\treturn noise4_Base(xs, ys, zs, ws);\n\t}\n\t\n\t/**\n\t * 4D OpenSimplex2F noise base.\n\t * Current implementation not fully optimized by lookup tables.\n\t * But still comes out slightly ahead of Gustavson's Simplex in tests.\n\t */\n\tprivate double noise4_Base(double xs, double ys, double zs, double ws) {\n\t\tdouble value = 0;\n\t\t\n\t\t// Get base points and offsets\n\t\tint xsb = fastFloor(xs), ysb = fastFloor(ys), zsb = fastFloor(zs), wsb = fastFloor(ws);\n\t\tdouble xsi = xs - xsb, ysi = ys - ysb, zsi = zs - zsb, wsi = ws - wsb;\n\t\t\n\t\t// If we're in the lower half, flip so we can repeat the code for the upper half. We'll flip back later.\n\t\tdouble siSum = xsi + ysi + zsi + wsi;\n\t\tdouble ssi = siSum * 0.309016994374947; // Prep for vertex contributions.\n\t\tboolean inLowerHalf = (siSum < 2);\n\t\tif (inLowerHalf) {\n\t\t\txsi = 1 - xsi; ysi = 1 - ysi; zsi = 1 - zsi; wsi = 1 - wsi;\n\t\t\tsiSum = 4 - siSum;\n\t\t}\n\t\t\n\t\t// Consider opposing vertex pairs of the octahedron formed by the central cross-section of the stretched tesseract\n\t\tdouble aabb = xsi + ysi - zsi - wsi, abab = xsi - ysi + zsi - wsi, abba = xsi - ysi - zsi + wsi;\n\t\tdouble aabbScore = Math.abs(aabb), ababScore = Math.abs(abab), abbaScore = Math.abs(abba);\n\t\t\n\t\t// Find the closest point on the stretched tesseract as if it were the upper half\n\t\tint vertexIndex, via, vib;\n\t\tdouble asi, bsi;\n\t\tif (aabbScore > ababScore && aabbScore > abbaScore) {\n\t\t\tif (aabb > 0) {\n\t\t\t\tasi = zsi; bsi = wsi; vertexIndex = 0b0011; via = 0b0111; vib = 0b1011;\n\t\t\t} else {\n\t\t\t\tasi = xsi; bsi = ysi; vertexIndex = 0b1100; via = 0b1101; vib = 0b1110;\n\t\t\t}\n\t\t} else if (ababScore > abbaScore) {\n\t\t\tif (abab > 0) {\n\t\t\t\tasi = ysi; bsi = wsi; vertexIndex = 0b0101; via = 0b0111; vib = 0b1101;\n\t\t\t} else {\n\t\t\t\tasi = xsi; bsi = zsi; vertexIndex = 0b1010; via = 0b1011; vib = 0b1110;\n\t\t\t}\n\t\t} else {\n\t\t\tif (abba > 0) {\n\t\t\t\tasi = ysi; bsi = zsi; vertexIndex = 0b1001; via = 0b1011; vib = 0b1101;\n\t\t\t} else {\n\t\t\t\tasi = xsi; bsi = wsi; vertexIndex = 0b0110; via = 0b0111; vib = 0b1110;\n\t\t\t}\n\t\t}\n\t\tif (bsi > asi) {\n\t\t\tvia = vib;\n\t\t\tdouble temp = bsi;\n\t\t\tbsi = asi;\n\t\t\tasi = temp;\n\t\t}\n\t\tif (siSum + asi > 3) {\n\t\t\tvertexIndex = via;\n\t\t\tif (siSum + bsi > 4) {\n\t\t\t\tvertexIndex = 0b1111;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Now flip back if we're actually in the lower half.\n\t\tif (inLowerHalf) {\n\t\t\txsi = 1 - xsi; ysi = 1 - ysi; zsi = 1 - zsi; wsi = 1 - wsi;\n\t\t\tvertexIndex ^= 0b1111;\n\t\t}\n\t\t\n\t\t// Five points to add, total, from five copies of the A4 lattice.\n\t\tfor (int i = 0; i < 5; i++) {\n\t\t\n\t\t\t// Update xsb/etc. and add the lattice point's contribution.\n\t\t\tLatticePoint4D c = VERTICES_4D[vertexIndex];\n\t\t\txsb += c.xsv; ysb += c.ysv; zsb += c.zsv; wsb += c.wsv;\n\t\t\tdouble xi = xsi + ssi, yi = ysi + ssi, zi = zsi + ssi, wi = wsi + ssi;\n\t\t\tdouble dx = xi + c.dx, dy = yi + c.dy, dz = zi + c.dz, dw = wi + c.dw;\n\t\t\tdouble attn = 0.5 - dx * dx - dy * dy - dz * dz - dw * dw;\n\t\t\tif (attn > 0) {\n\t\t\t\tint pxm = xsb & PMASK, pym = ysb & PMASK, pzm = zsb & PMASK, pwm = wsb & PMASK;\n\t\t\t\tGrad4 grad = permGrad4[perm[perm[perm[pxm] ^ pym] ^ pzm] ^ pwm];\n\t\t\t\tdouble ramped = grad.dx * dx + grad.dy * dy + grad.dz * dz + grad.dw * dw;\n\t\t\t\t\n\t\t\t\tattn *= attn;\n\t\t\t\tvalue += attn * attn * ramped;\n\t\t\t}\n\t\t\t\n\t\t\t// Maybe this helps the compiler/JVM/LLVM/etc. know we can end the loop here. Maybe not.\n\t\t\tif (i == 4) break;\n\t\t\t\n\t\t\t// Update the relative skewed coordinates to reference the vertex we just added.\n\t\t\t// Rather, reference its counterpart on the lattice copy that is shifted down by\n\t\t\t// the vector <-0.2, -0.2, -0.2, -0.2>\n\t\t\txsi += c.xsi; ysi += c.ysi; zsi += c.zsi; wsi += c.wsi;\n\t\t\tssi += c.ssiDelta;\n\t\t\t\n\t\t\t// Next point is the closest vertex on the 4-simplex whose base vertex is the aforementioned vertex.\n\t\t\tdouble score0 = 1.0 + ssi * (-1.0 / 0.309016994374947); // Seems slightly faster than 1.0-xsi-ysi-zsi-wsi\n\t\t\tvertexIndex = 0b0000;\n\t\t\tif (xsi >= ysi && xsi >= zsi && xsi >= wsi && xsi >= score0) {\n\t\t\t\tvertexIndex = 0b0001;\n\t\t\t}\n\t\t\telse if (ysi > xsi && ysi >= zsi && ysi >= wsi && ysi >= score0) {\n\t\t\t\tvertexIndex = 0b0010;\n\t\t\t}\n\t\t\telse if (zsi > xsi && zsi > ysi && zsi >= wsi && zsi >= score0) {\n\t\t\t\tvertexIndex = 0b0100;\n\t\t\t}\n\t\t\telse if (wsi > xsi && wsi > ysi && wsi > zsi && wsi >= score0) {\n\t\t\t\tvertexIndex = 0b1000;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn value;\n\t}\n\t\n\t/*\n\t * Utility\n\t */\n\t\n\tprivate static int fastFloor(double x) {\n\t\tint xi = (int)x;\n\t\treturn x < xi ? xi - 1 : xi;\n\t}\n\t\n\t/*\n\t * Definitions\n\t */\n\n\tprivate static final LatticePoint2D[] LOOKUP_2D;\n\tprivate static final LatticePoint3D[] LOOKUP_3D;\n\tprivate static final LatticePoint4D[] VERTICES_4D;\n\tstatic {\n\t\tLOOKUP_2D = new LatticePoint2D[4];\n\t\tLOOKUP_3D = new LatticePoint3D[8];\n\t\tVERTICES_4D = new LatticePoint4D[16];\n\t\t\n\t\tLOOKUP_2D[0] = new LatticePoint2D(1, 0);\n\t\tLOOKUP_2D[1] = new LatticePoint2D(0, 0);\n\t\tLOOKUP_2D[2] = new LatticePoint2D(1, 1);\n\t\tLOOKUP_2D[3] = new LatticePoint2D(0, 1);\n\t\t\n\t\tfor (int i = 0; i < 8; i++) {\n\t\t\tint i1, j1, k1, i2, j2, k2;\n\t\t\ti1 = (i >> 0) & 1; j1 = (i >> 1) & 1; k1 = (i >> 2) & 1;\n\t\t\ti2 = i1 ^ 1; j2 = j1 ^ 1; k2 = k1 ^ 1;\n\t\t\t\n\t\t\t// The two points within this octant, one from each of the two cubic half-lattices.\n\t\t\tLatticePoint3D c0 = new LatticePoint3D(i1, j1, k1, 0);\n\t\t\tLatticePoint3D c1 = new LatticePoint3D(i1 + i2, j1 + j2, k1 + k2, 1);\n\t\t\t\n\t\t\t// Each single step away on the first half-lattice.\n\t\t\tLatticePoint3D c2 = new LatticePoint3D(i1 ^ 1, j1, k1, 0);\n\t\t\tLatticePoint3D c3 = new LatticePoint3D(i1, j1 ^ 1, k1, 0);\n\t\t\tLatticePoint3D c4 = new LatticePoint3D(i1, j1, k1 ^ 1, 0);\n\t\t\t\n\t\t\t// Each single step away on the second half-lattice.\n\t\t\tLatticePoint3D c5 = new LatticePoint3D(i1 + (i2 ^ 1), j1 + j2, k1 + k2, 1);\n\t\t\tLatticePoint3D c6 = new LatticePoint3D(i1 + i2, j1 + (j2 ^ 1), k1 + k2, 1);\n\t\t\tLatticePoint3D c7 = new LatticePoint3D(i1 + i2, j1 + j2, k1 + (k2 ^ 1), 1);\n\t\t\t\n\t\t\t// First two are guaranteed.\n\t\t\tc0.nextOnFailure = c0.nextOnSuccess = c1;\n\t\t\tc1.nextOnFailure = c1.nextOnSuccess = c2;\n\t\t\t\n\t\t\t// Once we find one on the first half-lattice, the rest are out.\n\t\t\t// In addition, knowing c2 rules out c5.\n\t\t\tc2.nextOnFailure = c3; c2.nextOnSuccess = c6;\n\t\t\tc3.nextOnFailure = c4; c3.nextOnSuccess = c5;\n\t\t\tc4.nextOnFailure = c4.nextOnSuccess = c5;\n\t\t\t\n\t\t\t// Once we find one on the second half-lattice, the rest are out.\n\t\t\tc5.nextOnFailure = c6; c5.nextOnSuccess = null;\n\t\t\tc6.nextOnFailure = c7; c6.nextOnSuccess = null;\n\t\t\tc7.nextOnFailure = c7.nextOnSuccess = null;\n\t\t\t\n\t\t\tLOOKUP_3D[i] = c0;\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < 16; i++) {\n\t\t\tVERTICES_4D[i] = new LatticePoint4D((i >> 0) & 1, (i >> 1) & 1, (i >> 2) & 1, (i >> 3) & 1);\n\t\t}\n\t}\n\t\n\tprivate static class LatticePoint2D {\n\t\tint xsv, ysv;\n\t\tdouble dx, dy;\n\t\tpublic LatticePoint2D(int xsv, int ysv) {\n\t\t\tthis.xsv = xsv; this.ysv = ysv;\n\t\t\tdouble ssv = (xsv + ysv) * -0.211324865405187;\n\t\t\tthis.dx = -xsv - ssv;\n\t\t\tthis.dy = -ysv - ssv;\n\t\t}\n\t}\n\t\n\tprivate static class LatticePoint3D {\n\t\tpublic double dxr, dyr, dzr;\n\t\tpublic int xrv, yrv, zrv;\n\t\tLatticePoint3D nextOnFailure, nextOnSuccess;\n\t\tpublic LatticePoint3D(int xrv, int yrv, int zrv, int lattice) {\n\t\t\tthis.dxr = -xrv + lattice * 0.5; this.dyr = -yrv + lattice * 0.5; this.dzr = -zrv + lattice * 0.5;\n\t\t\tthis.xrv = xrv + lattice * 1024; this.yrv = yrv + lattice * 1024; this.zrv = zrv + lattice * 1024;\n\t\t}\n\t}\n\t\n\tprivate static class LatticePoint4D {\n\t\tint xsv, ysv, zsv, wsv;\n\t\tdouble dx, dy, dz, dw;\n\t\tdouble xsi, ysi, zsi, wsi;\n\t\tdouble ssiDelta;\n\t\tpublic LatticePoint4D(int xsv, int ysv, int zsv, int wsv) {\n\t\t\tthis.xsv = xsv + 409; this.ysv = ysv + 409; this.zsv = zsv + 409; this.wsv = wsv + 409;\n\t\t\tdouble ssv = (xsv + ysv + zsv + wsv) * 0.309016994374947;\n\t\t\tthis.dx = -xsv - ssv;\n\t\t\tthis.dy = -ysv - ssv;\n\t\t\tthis.dz = -zsv - ssv;\n\t\t\tthis.dw = -wsv - ssv;\n\t\t\tthis.xsi = 0.2 - xsv;\n\t\t\tthis.ysi = 0.2 - ysv;\n\t\t\tthis.zsi = 0.2 - zsv;\n\t\t\tthis.wsi = 0.2 - wsv;\n\t\t\tthis.ssiDelta = (0.8 - xsv - ysv - zsv - wsv) * 0.309016994374947;\n\t\t}\n\t}\n\t\n\t/*\n\t * Gradients\n\t */\n\t\n\tprivate static class Grad2 {\n\t\tdouble dx, dy;\n\t\tpublic Grad2(double dx, double dy) {\n\t\t\tthis.dx = dx; this.dy = dy;\n\t\t}\n\t}\n\t\n\tprivate static class Grad3 {\n\t\tdouble dx, dy, dz;\n\t\tpublic Grad3(double dx, double dy, double dz) {\n\t\t\tthis.dx = dx; this.dy = dy; this.dz = dz;\n\t\t}\n\t}\n\t\n\tprivate static class Grad4 {\n\t\tdouble dx, dy, dz, dw;\n\t\tpublic Grad4(double dx, double dy, double dz,  double dw) {\n\t\t\tthis.dx = dx; this.dy = dy; this.dz = dz; this.dw = dw;\n\t\t}\n\t}\n\t\n\tprivate static final double N2 = 0.01001634121365712;\n\tprivate static final double N3 = 0.030485933181293584;\n\tprivate static final double N4 = 0.009202377986303158;\n\tprivate static final Grad2[] GRADIENTS_2D;\n\tprivate static final Grad3[] GRADIENTS_3D;\n\tprivate static final Grad4[] GRADIENTS_4D;\n\tstatic {\n\t\t\n\t\tGRADIENTS_2D = new Grad2[PSIZE];\n\t\tGrad2[] grad2 = {\n\t\t\tnew Grad2( 0.130526192220052,  0.99144486137381),\n\t\t\tnew Grad2( 0.38268343236509,   0.923879532511287),\n\t\t\tnew Grad2( 0.608761429008721,  0.793353340291235),\n\t\t\tnew Grad2( 0.793353340291235,  0.608761429008721),\n\t\t\tnew Grad2( 0.923879532511287,  0.38268343236509),\n\t\t\tnew Grad2( 0.99144486137381,   0.130526192220051),\n\t\t\tnew Grad2( 0.99144486137381,  -0.130526192220051),\n\t\t\tnew Grad2( 0.923879532511287, -0.38268343236509),\n\t\t\tnew Grad2( 0.793353340291235, -0.60876142900872),\n\t\t\tnew Grad2( 0.608761429008721, -0.793353340291235),\n\t\t\tnew Grad2( 0.38268343236509,  -0.923879532511287),\n\t\t\tnew Grad2( 0.130526192220052, -0.99144486137381),\n\t\t\tnew Grad2(-0.130526192220052, -0.99144486137381),\n\t\t\tnew Grad2(-0.38268343236509,  -0.923879532511287),\n\t\t\tnew Grad2(-0.608761429008721, -0.793353340291235),\n\t\t\tnew Grad2(-0.793353340291235, -0.608761429008721),\n\t\t\tnew Grad2(-0.923879532511287, -0.38268343236509),\n\t\t\tnew Grad2(-0.99144486137381,  -0.130526192220052),\n\t\t\tnew Grad2(-0.99144486137381,   0.130526192220051),\n\t\t\tnew Grad2(-0.923879532511287,  0.38268343236509),\n\t\t\tnew Grad2(-0.793353340291235,  0.608761429008721),\n\t\t\tnew Grad2(-0.608761429008721,  0.793353340291235),\n\t\t\tnew Grad2(-0.38268343236509,   0.923879532511287),\n\t\t\tnew Grad2(-0.130526192220052,  0.99144486137381)\n\t\t};\n\t\tfor (int i = 0; i < grad2.length; i++) {\n\t\t\tgrad2[i].dx /= N2; grad2[i].dy /= N2;\n\t\t}\n\t\tfor (int i = 0; i < PSIZE; i++) {\n\t\t\tGRADIENTS_2D[i] = grad2[i % grad2.length];\n\t\t}\n\t\t\n\t\tGRADIENTS_3D = new Grad3[PSIZE];\n\t\tGrad3[] grad3 = {\n\t\t\tnew Grad3(-2.22474487139,      -2.22474487139,      -1.0),\n\t\t\tnew Grad3(-2.22474487139,      -2.22474487139,       1.0),\n\t\t\tnew Grad3(-3.0862664687972017, -1.1721513422464978,  0.0),\n\t\t\tnew Grad3(-1.1721513422464978, -3.0862664687972017,  0.0),\n\t\t\tnew Grad3(-2.22474487139,      -1.0,                -2.22474487139),\n\t\t\tnew Grad3(-2.22474487139,       1.0,                -2.22474487139),\n\t\t\tnew Grad3(-1.1721513422464978,  0.0,                -3.0862664687972017),\n\t\t\tnew Grad3(-3.0862664687972017,  0.0,                -1.1721513422464978),\n\t\t\tnew Grad3(-2.22474487139,      -1.0,                 2.22474487139),\n\t\t\tnew Grad3(-2.22474487139,       1.0,                 2.22474487139),\n\t\t\tnew Grad3(-3.0862664687972017,  0.0,                 1.1721513422464978),\n\t\t\tnew Grad3(-1.1721513422464978,  0.0,                 3.0862664687972017),\n\t\t\tnew Grad3(-2.22474487139,       2.22474487139,      -1.0),\n\t\t\tnew Grad3(-2.22474487139,       2.22474487139,       1.0),\n\t\t\tnew Grad3(-1.1721513422464978,  3.0862664687972017,  0.0),\n\t\t\tnew Grad3(-3.0862664687972017,  1.1721513422464978,  0.0),\n\t\t\tnew Grad3(-1.0,                -2.22474487139,      -2.22474487139),\n\t\t\tnew Grad3( 1.0,                -2.22474487139,      -2.22474487139),\n\t\t\tnew Grad3( 0.0,                -3.0862664687972017, -1.1721513422464978),\n\t\t\tnew Grad3( 0.0,                -1.1721513422464978, -3.0862664687972017),\n\t\t\tnew Grad3(-1.0,                -2.22474487139,       2.22474487139),\n\t\t\tnew Grad3( 1.0,                -2.22474487139,       2.22474487139),\n\t\t\tnew Grad3( 0.0,                -1.1721513422464978,  3.0862664687972017),\n\t\t\tnew Grad3( 0.0,                -3.0862664687972017,  1.1721513422464978),\n\t\t\tnew Grad3(-1.0,                 2.22474487139,      -2.22474487139),\n\t\t\tnew Grad3( 1.0,                 2.22474487139,      -2.22474487139),\n\t\t\tnew Grad3( 0.0,                 1.1721513422464978, -3.0862664687972017),\n\t\t\tnew Grad3( 0.0,                 3.0862664687972017, -1.1721513422464978),\n\t\t\tnew Grad3(-1.0,                 2.22474487139,       2.22474487139),\n\t\t\tnew Grad3( 1.0,                 2.22474487139,       2.22474487139),\n\t\t\tnew Grad3( 0.0,                 3.0862664687972017,  1.1721513422464978),\n\t\t\tnew Grad3( 0.0,                 1.1721513422464978,  3.0862664687972017),\n\t\t\tnew Grad3( 2.22474487139,      -2.22474487139,      -1.0),\n\t\t\tnew Grad3( 2.22474487139,      -2.22474487139,       1.0),\n\t\t\tnew Grad3( 1.1721513422464978, -3.0862664687972017,  0.0),\n\t\t\tnew Grad3( 3.0862664687972017, -1.1721513422464978,  0.0),\n\t\t\tnew Grad3( 2.22474487139,      -1.0,                -2.22474487139),\n\t\t\tnew Grad3( 2.22474487139,       1.0,                -2.22474487139),\n\t\t\tnew Grad3( 3.0862664687972017,  0.0,                -1.1721513422464978),\n\t\t\tnew Grad3( 1.1721513422464978,  0.0,                -3.0862664687972017),\n\t\t\tnew Grad3( 2.22474487139,      -1.0,                 2.22474487139),\n\t\t\tnew Grad3( 2.22474487139,       1.0,                 2.22474487139),\n\t\t\tnew Grad3( 1.1721513422464978,  0.0,                 3.0862664687972017),\n\t\t\tnew Grad3( 3.0862664687972017,  0.0,                 1.1721513422464978),\n\t\t\tnew Grad3( 2.22474487139,       2.22474487139,      -1.0),\n\t\t\tnew Grad3( 2.22474487139,       2.22474487139,       1.0),\n\t\t\tnew Grad3( 3.0862664687972017,  1.1721513422464978,  0.0),\n\t\t\tnew Grad3( 1.1721513422464978,  3.0862664687972017,  0.0)\n\t\t};\n\t\tfor (int i = 0; i < grad3.length; i++) {\n\t\t\tgrad3[i].dx /= N3; grad3[i].dy /= N3; grad3[i].dz /= N3;\n\t\t}\n\t\tfor (int i = 0; i < PSIZE; i++) {\n\t\t\tGRADIENTS_3D[i] = grad3[i % grad3.length];\n\t\t}\n\t\t\n\t\tGRADIENTS_4D = new Grad4[PSIZE];\n\t\tGrad4[] grad4 = {\n\t\t\tnew Grad4(-0.753341017856078,    -0.37968289875261624,  -0.37968289875261624,  -0.37968289875261624),\n\t\t\tnew Grad4(-0.7821684431180708,   -0.4321472685365301,   -0.4321472685365301,    0.12128480194602098),\n\t\t\tnew Grad4(-0.7821684431180708,   -0.4321472685365301,    0.12128480194602098,  -0.4321472685365301),\n\t\t\tnew Grad4(-0.7821684431180708,    0.12128480194602098,  -0.4321472685365301,   -0.4321472685365301),\n\t\t\tnew Grad4(-0.8586508742123365,   -0.508629699630796,     0.044802370851755174,  0.044802370851755174),\n\t\t\tnew Grad4(-0.8586508742123365,    0.044802370851755174, -0.508629699630796,     0.044802370851755174),\n\t\t\tnew Grad4(-0.8586508742123365,    0.044802370851755174,  0.044802370851755174, -0.508629699630796),\n\t\t\tnew Grad4(-0.9982828964265062,   -0.03381941603233842,  -0.03381941603233842,  -0.03381941603233842),\n\t\t\tnew Grad4(-0.37968289875261624,  -0.753341017856078,    -0.37968289875261624,  -0.37968289875261624),\n\t\t\tnew Grad4(-0.4321472685365301,   -0.7821684431180708,   -0.4321472685365301,    0.12128480194602098),\n\t\t\tnew Grad4(-0.4321472685365301,   -0.7821684431180708,    0.12128480194602098,  -0.4321472685365301),\n\t\t\tnew Grad4( 0.12128480194602098,  -0.7821684431180708,   -0.4321472685365301,   -0.4321472685365301),\n\t\t\tnew Grad4(-0.508629699630796,    -0.8586508742123365,    0.044802370851755174,  0.044802370851755174),\n\t\t\tnew Grad4( 0.044802370851755174, -0.8586508742123365,   -0.508629699630796,     0.044802370851755174),\n\t\t\tnew Grad4( 0.044802370851755174, -0.8586508742123365,    0.044802370851755174, -0.508629699630796),\n\t\t\tnew Grad4(-0.03381941603233842,  -0.9982828964265062,   -0.03381941603233842,  -0.03381941603233842),\n\t\t\tnew Grad4(-0.37968289875261624,  -0.37968289875261624,  -0.753341017856078,    -0.37968289875261624),\n\t\t\tnew Grad4(-0.4321472685365301,   -0.4321472685365301,   -0.7821684431180708,    0.12128480194602098),\n\t\t\tnew Grad4(-0.4321472685365301,    0.12128480194602098,  -0.7821684431180708,   -0.4321472685365301),\n\t\t\tnew Grad4( 0.12128480194602098,  -0.4321472685365301,   -0.7821684431180708,   -0.4321472685365301),\n\t\t\tnew Grad4(-0.508629699630796,     0.044802370851755174, -0.8586508742123365,    0.044802370851755174),\n\t\t\tnew Grad4( 0.044802370851755174, -0.508629699630796,    -0.8586508742123365,    0.044802370851755174),\n\t\t\tnew Grad4( 0.044802370851755174,  0.044802370851755174, -0.8586508742123365,   -0.508629699630796),\n\t\t\tnew Grad4(-0.03381941603233842,  -0.03381941603233842,  -0.9982828964265062,   -0.03381941603233842),\n\t\t\tnew Grad4(-0.37968289875261624,  -0.37968289875261624,  -0.37968289875261624,  -0.753341017856078),\n\t\t\tnew Grad4(-0.4321472685365301,   -0.4321472685365301,    0.12128480194602098,  -0.7821684431180708),\n\t\t\tnew Grad4(-0.4321472685365301,    0.12128480194602098,  -0.4321472685365301,   -0.7821684431180708),\n\t\t\tnew Grad4( 0.12128480194602098,  -0.4321472685365301,   -0.4321472685365301,   -0.7821684431180708),\n\t\t\tnew Grad4(-0.508629699630796,     0.044802370851755174,  0.044802370851755174, -0.8586508742123365),\n\t\t\tnew Grad4( 0.044802370851755174, -0.508629699630796,     0.044802370851755174, -0.8586508742123365),\n\t\t\tnew Grad4( 0.044802370851755174,  0.044802370851755174, -0.508629699630796,    -0.8586508742123365),\n\t\t\tnew Grad4(-0.03381941603233842,  -0.03381941603233842,  -0.03381941603233842,  -0.9982828964265062),\n\t\t\tnew Grad4(-0.6740059517812944,   -0.3239847771997537,   -0.3239847771997537,    0.5794684678643381),\n\t\t\tnew Grad4(-0.7504883828755602,   -0.4004672082940195,    0.15296486218853164,   0.5029860367700724),\n\t\t\tnew Grad4(-0.7504883828755602,    0.15296486218853164,  -0.4004672082940195,    0.5029860367700724),\n\t\t\tnew Grad4(-0.8828161875373585,    0.08164729285680945,   0.08164729285680945,   0.4553054119602712),\n\t\t\tnew Grad4(-0.4553054119602712,   -0.08164729285680945,  -0.08164729285680945,   0.8828161875373585),\n\t\t\tnew Grad4(-0.5029860367700724,   -0.15296486218853164,   0.4004672082940195,    0.7504883828755602),\n\t\t\tnew Grad4(-0.5029860367700724,    0.4004672082940195,   -0.15296486218853164,   0.7504883828755602),\n\t\t\tnew Grad4(-0.5794684678643381,    0.3239847771997537,    0.3239847771997537,    0.6740059517812944),\n\t\t\tnew Grad4(-0.3239847771997537,   -0.6740059517812944,   -0.3239847771997537,    0.5794684678643381),\n\t\t\tnew Grad4(-0.4004672082940195,   -0.7504883828755602,    0.15296486218853164,   0.5029860367700724),\n\t\t\tnew Grad4( 0.15296486218853164,  -0.7504883828755602,   -0.4004672082940195,    0.5029860367700724),\n\t\t\tnew Grad4( 0.08164729285680945,  -0.8828161875373585,    0.08164729285680945,   0.4553054119602712),\n\t\t\tnew Grad4(-0.08164729285680945,  -0.4553054119602712,   -0.08164729285680945,   0.8828161875373585),\n\t\t\tnew Grad4(-0.15296486218853164,  -0.5029860367700724,    0.4004672082940195,    0.7504883828755602),\n\t\t\tnew Grad4( 0.4004672082940195,   -0.5029860367700724,   -0.15296486218853164,   0.7504883828755602),\n\t\t\tnew Grad4( 0.3239847771997537,   -0.5794684678643381,    0.3239847771997537,    0.6740059517812944),\n\t\t\tnew Grad4(-0.3239847771997537,   -0.3239847771997537,   -0.6740059517812944,    0.5794684678643381),\n\t\t\tnew Grad4(-0.4004672082940195,    0.15296486218853164,  -0.7504883828755602,    0.5029860367700724),\n\t\t\tnew Grad4( 0.15296486218853164,  -0.4004672082940195,   -0.7504883828755602,    0.5029860367700724),\n\t\t\tnew Grad4( 0.08164729285680945,   0.08164729285680945,  -0.8828161875373585,    0.4553054119602712),\n\t\t\tnew Grad4(-0.08164729285680945,  -0.08164729285680945,  -0.4553054119602712,    0.8828161875373585),\n\t\t\tnew Grad4(-0.15296486218853164,   0.4004672082940195,   -0.5029860367700724,    0.7504883828755602),\n\t\t\tnew Grad4( 0.4004672082940195,   -0.15296486218853164,  -0.5029860367700724,    0.7504883828755602),\n\t\t\tnew Grad4( 0.3239847771997537,    0.3239847771997537,   -0.5794684678643381,    0.6740059517812944),\n\t\t\tnew Grad4(-0.6740059517812944,   -0.3239847771997537,    0.5794684678643381,   -0.3239847771997537),\n\t\t\tnew Grad4(-0.7504883828755602,   -0.4004672082940195,    0.5029860367700724,    0.15296486218853164),\n\t\t\tnew Grad4(-0.7504883828755602,    0.15296486218853164,   0.5029860367700724,   -0.4004672082940195),\n\t\t\tnew Grad4(-0.8828161875373585,    0.08164729285680945,   0.4553054119602712,    0.08164729285680945),\n\t\t\tnew Grad4(-0.4553054119602712,   -0.08164729285680945,   0.8828161875373585,   -0.08164729285680945),\n\t\t\tnew Grad4(-0.5029860367700724,   -0.15296486218853164,   0.7504883828755602,    0.4004672082940195),\n\t\t\tnew Grad4(-0.5029860367700724,    0.4004672082940195,    0.7504883828755602,   -0.15296486218853164),\n\t\t\tnew Grad4(-0.5794684678643381,    0.3239847771997537,    0.6740059517812944,    0.3239847771997537),\n\t\t\tnew Grad4(-0.3239847771997537,   -0.6740059517812944,    0.5794684678643381,   -0.3239847771997537),\n\t\t\tnew Grad4(-0.4004672082940195,   -0.7504883828755602,    0.5029860367700724,    0.15296486218853164),\n\t\t\tnew Grad4( 0.15296486218853164,  -0.7504883828755602,    0.5029860367700724,   -0.4004672082940195),\n\t\t\tnew Grad4( 0.08164729285680945,  -0.8828161875373585,    0.4553054119602712,    0.08164729285680945),\n\t\t\tnew Grad4(-0.08164729285680945,  -0.4553054119602712,    0.8828161875373585,   -0.08164729285680945),\n\t\t\tnew Grad4(-0.15296486218853164,  -0.5029860367700724,    0.7504883828755602,    0.4004672082940195),\n\t\t\tnew Grad4( 0.4004672082940195,   -0.5029860367700724,    0.7504883828755602,   -0.15296486218853164),\n\t\t\tnew Grad4( 0.3239847771997537,   -0.5794684678643381,    0.6740059517812944,    0.3239847771997537),\n\t\t\tnew Grad4(-0.3239847771997537,   -0.3239847771997537,    0.5794684678643381,   -0.6740059517812944),\n\t\t\tnew Grad4(-0.4004672082940195,    0.15296486218853164,   0.5029860367700724,   -0.7504883828755602),\n\t\t\tnew Grad4( 0.15296486218853164,  -0.4004672082940195,    0.5029860367700724,   -0.7504883828755602),\n\t\t\tnew Grad4( 0.08164729285680945,   0.08164729285680945,   0.4553054119602712,   -0.8828161875373585),\n\t\t\tnew Grad4(-0.08164729285680945,  -0.08164729285680945,   0.8828161875373585,   -0.4553054119602712),\n\t\t\tnew Grad4(-0.15296486218853164,   0.4004672082940195,    0.7504883828755602,   -0.5029860367700724),\n\t\t\tnew Grad4( 0.4004672082940195,   -0.15296486218853164,   0.7504883828755602,   -0.5029860367700724),\n\t\t\tnew Grad4( 0.3239847771997537,    0.3239847771997537,    0.6740059517812944,   -0.5794684678643381),\n\t\t\tnew Grad4(-0.6740059517812944,    0.5794684678643381,   -0.3239847771997537,   -0.3239847771997537),\n\t\t\tnew Grad4(-0.7504883828755602,    0.5029860367700724,   -0.4004672082940195,    0.15296486218853164),\n\t\t\tnew Grad4(-0.7504883828755602,    0.5029860367700724,    0.15296486218853164,  -0.4004672082940195),\n\t\t\tnew Grad4(-0.8828161875373585,    0.4553054119602712,    0.08164729285680945,   0.08164729285680945),\n\t\t\tnew Grad4(-0.4553054119602712,    0.8828161875373585,   -0.08164729285680945,  -0.08164729285680945),\n\t\t\tnew Grad4(-0.5029860367700724,    0.7504883828755602,   -0.15296486218853164,   0.4004672082940195),\n\t\t\tnew Grad4(-0.5029860367700724,    0.7504883828755602,    0.4004672082940195,   -0.15296486218853164),\n\t\t\tnew Grad4(-0.5794684678643381,    0.6740059517812944,    0.3239847771997537,    0.3239847771997537),\n\t\t\tnew Grad4(-0.3239847771997537,    0.5794684678643381,   -0.6740059517812944,   -0.3239847771997537),\n\t\t\tnew Grad4(-0.4004672082940195,    0.5029860367700724,   -0.7504883828755602,    0.15296486218853164),\n\t\t\tnew Grad4( 0.15296486218853164,   0.5029860367700724,   -0.7504883828755602,   -0.4004672082940195),\n\t\t\tnew Grad4( 0.08164729285680945,   0.4553054119602712,   -0.8828161875373585,    0.08164729285680945),\n\t\t\tnew Grad4(-0.08164729285680945,   0.8828161875373585,   -0.4553054119602712,   -0.08164729285680945),\n\t\t\tnew Grad4(-0.15296486218853164,   0.7504883828755602,   -0.5029860367700724,    0.4004672082940195),\n\t\t\tnew Grad4( 0.4004672082940195,    0.7504883828755602,   -0.5029860367700724,   -0.15296486218853164),\n\t\t\tnew Grad4( 0.3239847771997537,    0.6740059517812944,   -0.5794684678643381,    0.3239847771997537),\n\t\t\tnew Grad4(-0.3239847771997537,    0.5794684678643381,   -0.3239847771997537,   -0.6740059517812944),\n\t\t\tnew Grad4(-0.4004672082940195,    0.5029860367700724,    0.15296486218853164,  -0.7504883828755602),\n\t\t\tnew Grad4( 0.15296486218853164,   0.5029860367700724,   -0.4004672082940195,   -0.7504883828755602),\n\t\t\tnew Grad4( 0.08164729285680945,   0.4553054119602712,    0.08164729285680945,  -0.8828161875373585),\n\t\t\tnew Grad4(-0.08164729285680945,   0.8828161875373585,   -0.08164729285680945,  -0.4553054119602712),\n\t\t\tnew Grad4(-0.15296486218853164,   0.7504883828755602,    0.4004672082940195,   -0.5029860367700724),\n\t\t\tnew Grad4( 0.4004672082940195,    0.7504883828755602,   -0.15296486218853164,  -0.5029860367700724),\n\t\t\tnew Grad4( 0.3239847771997537,    0.6740059517812944,    0.3239847771997537,   -0.5794684678643381),\n\t\t\tnew Grad4( 0.5794684678643381,   -0.6740059517812944,   -0.3239847771997537,   -0.3239847771997537),\n\t\t\tnew Grad4( 0.5029860367700724,   -0.7504883828755602,   -0.4004672082940195,    0.15296486218853164),\n\t\t\tnew Grad4( 0.5029860367700724,   -0.7504883828755602,    0.15296486218853164,  -0.4004672082940195),\n\t\t\tnew Grad4( 0.4553054119602712,   -0.8828161875373585,    0.08164729285680945,   0.08164729285680945),\n\t\t\tnew Grad4( 0.8828161875373585,   -0.4553054119602712,   -0.08164729285680945,  -0.08164729285680945),\n\t\t\tnew Grad4( 0.7504883828755602,   -0.5029860367700724,   -0.15296486218853164,   0.4004672082940195),\n\t\t\tnew Grad4( 0.7504883828755602,   -0.5029860367700724,    0.4004672082940195,   -0.15296486218853164),\n\t\t\tnew Grad4( 0.6740059517812944,   -0.5794684678643381,    0.3239847771997537,    0.3239847771997537),\n\t\t\tnew Grad4( 0.5794684678643381,   -0.3239847771997537,   -0.6740059517812944,   -0.3239847771997537),\n\t\t\tnew Grad4( 0.5029860367700724,   -0.4004672082940195,   -0.7504883828755602,    0.15296486218853164),\n\t\t\tnew Grad4( 0.5029860367700724,    0.15296486218853164,  -0.7504883828755602,   -0.4004672082940195),\n\t\t\tnew Grad4( 0.4553054119602712,    0.08164729285680945,  -0.8828161875373585,    0.08164729285680945),\n\t\t\tnew Grad4( 0.8828161875373585,   -0.08164729285680945,  -0.4553054119602712,   -0.08164729285680945),\n\t\t\tnew Grad4( 0.7504883828755602,   -0.15296486218853164,  -0.5029860367700724,    0.4004672082940195),\n\t\t\tnew Grad4( 0.7504883828755602,    0.4004672082940195,   -0.5029860367700724,   -0.15296486218853164),\n\t\t\tnew Grad4( 0.6740059517812944,    0.3239847771997537,   -0.5794684678643381,    0.3239847771997537),\n\t\t\tnew Grad4( 0.5794684678643381,   -0.3239847771997537,   -0.3239847771997537,   -0.6740059517812944),\n\t\t\tnew Grad4( 0.5029860367700724,   -0.4004672082940195,    0.15296486218853164,  -0.7504883828755602),\n\t\t\tnew Grad4( 0.5029860367700724,    0.15296486218853164,  -0.4004672082940195,   -0.7504883828755602),\n\t\t\tnew Grad4( 0.4553054119602712,    0.08164729285680945,   0.08164729285680945,  -0.8828161875373585),\n\t\t\tnew Grad4( 0.8828161875373585,   -0.08164729285680945,  -0.08164729285680945,  -0.4553054119602712),\n\t\t\tnew Grad4( 0.7504883828755602,   -0.15296486218853164,   0.4004672082940195,   -0.5029860367700724),\n\t\t\tnew Grad4( 0.7504883828755602,    0.4004672082940195,   -0.15296486218853164,  -0.5029860367700724),\n\t\t\tnew Grad4( 0.6740059517812944,    0.3239847771997537,    0.3239847771997537,   -0.5794684678643381),\n\t\t\tnew Grad4( 0.03381941603233842,   0.03381941603233842,   0.03381941603233842,   0.9982828964265062),\n\t\t\tnew Grad4(-0.044802370851755174, -0.044802370851755174,  0.508629699630796,     0.8586508742123365),\n\t\t\tnew Grad4(-0.044802370851755174,  0.508629699630796,    -0.044802370851755174,  0.8586508742123365),\n\t\t\tnew Grad4(-0.12128480194602098,   0.4321472685365301,    0.4321472685365301,    0.7821684431180708),\n\t\t\tnew Grad4( 0.508629699630796,    -0.044802370851755174, -0.044802370851755174,  0.8586508742123365),\n\t\t\tnew Grad4( 0.4321472685365301,   -0.12128480194602098,   0.4321472685365301,    0.7821684431180708),\n\t\t\tnew Grad4( 0.4321472685365301,    0.4321472685365301,   -0.12128480194602098,   0.7821684431180708),\n\t\t\tnew Grad4( 0.37968289875261624,   0.37968289875261624,   0.37968289875261624,   0.753341017856078),\n\t\t\tnew Grad4( 0.03381941603233842,   0.03381941603233842,   0.9982828964265062,    0.03381941603233842),\n\t\t\tnew Grad4(-0.044802370851755174,  0.044802370851755174,  0.8586508742123365,    0.508629699630796),\n\t\t\tnew Grad4(-0.044802370851755174,  0.508629699630796,     0.8586508742123365,   -0.044802370851755174),\n\t\t\tnew Grad4(-0.12128480194602098,   0.4321472685365301,    0.7821684431180708,    0.4321472685365301),\n\t\t\tnew Grad4( 0.508629699630796,    -0.044802370851755174,  0.8586508742123365,   -0.044802370851755174),\n\t\t\tnew Grad4( 0.4321472685365301,   -0.12128480194602098,   0.7821684431180708,    0.4321472685365301),\n\t\t\tnew Grad4( 0.4321472685365301,    0.4321472685365301,    0.7821684431180708,   -0.12128480194602098),\n\t\t\tnew Grad4( 0.37968289875261624,   0.37968289875261624,   0.753341017856078,     0.37968289875261624),\n\t\t\tnew Grad4( 0.03381941603233842,   0.9982828964265062,    0.03381941603233842,   0.03381941603233842),\n\t\t\tnew Grad4(-0.044802370851755174,  0.8586508742123365,   -0.044802370851755174,  0.508629699630796),\n\t\t\tnew Grad4(-0.044802370851755174,  0.8586508742123365,    0.508629699630796,    -0.044802370851755174),\n\t\t\tnew Grad4(-0.12128480194602098,   0.7821684431180708,    0.4321472685365301,    0.4321472685365301),\n\t\t\tnew Grad4( 0.508629699630796,     0.8586508742123365,   -0.044802370851755174, -0.044802370851755174),\n\t\t\tnew Grad4( 0.4321472685365301,    0.7821684431180708,   -0.12128480194602098,   0.4321472685365301),\n\t\t\tnew Grad4( 0.4321472685365301,    0.7821684431180708,    0.4321472685365301,   -0.12128480194602098),\n\t\t\tnew Grad4( 0.37968289875261624,   0.753341017856078,     0.37968289875261624,   0.37968289875261624),\n\t\t\tnew Grad4( 0.9982828964265062,    0.03381941603233842,   0.03381941603233842,   0.03381941603233842),\n\t\t\tnew Grad4( 0.8586508742123365,   -0.044802370851755174, -0.044802370851755174,  0.508629699630796),\n\t\t\tnew Grad4( 0.8586508742123365,   -0.044802370851755174,  0.508629699630796,    -0.044802370851755174),\n\t\t\tnew Grad4( 0.7821684431180708,   -0.12128480194602098,   0.4321472685365301,    0.4321472685365301),\n\t\t\tnew Grad4( 0.8586508742123365,    0.508629699630796,    -0.044802370851755174, -0.044802370851755174),\n\t\t\tnew Grad4( 0.7821684431180708,    0.4321472685365301,   -0.12128480194602098,   0.4321472685365301),\n\t\t\tnew Grad4( 0.7821684431180708,    0.4321472685365301,    0.4321472685365301,   -0.12128480194602098),\n\t\t\tnew Grad4( 0.753341017856078,     0.37968289875261624,   0.37968289875261624,   0.37968289875261624)\n\t\t};\n\t\tfor (int i = 0; i < grad4.length; i++) {\n\t\t\tgrad4[i].dx /= N4; grad4[i].dy /= N4; grad4[i].dz /= N4; grad4[i].dw /= N4;\n\t\t}\n\t\tfor (int i = 0; i < PSIZE; i++) {\n\t\t\tGRADIENTS_4D[i] = grad4[i % grad4.length];\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "_old/java/OpenSimplex2S.java",
    "content": "/**\n * K.jpg's OpenSimplex 2, smooth variant (\"SuperSimplex\")\n *\n * - 2D is standard simplex, modified to support larger kernels.\n *   Implemented using a lookup table.\n * - 3D is \"Re-oriented 8-point BCC noise\" which constructs a\n *   congruent BCC lattice in a much different way than usual.\n * - 4D uses a naïve pregenerated lookup table, and averages out\n *   to the expected performance.\n *\n * Multiple versions of each function are provided. See the\n * documentation above each, for more info.\n */\npublic class OpenSimplex2S {\n\t\n\tprivate static final int PSIZE = 2048;\n\tprivate static final int PMASK = 2047;\n\n\tprivate short[] perm;\n\tprivate Grad2[] permGrad2;\n\tprivate Grad3[] permGrad3;\n\tprivate Grad4[] permGrad4;\n\n\tpublic OpenSimplex2S(long seed) {\n\t\tperm = new short[PSIZE];\n\t\tpermGrad2 = new Grad2[PSIZE];\n\t\tpermGrad3 = new Grad3[PSIZE];\n\t\tpermGrad4 = new Grad4[PSIZE];\n\t\tshort[] source = new short[PSIZE]; \n\t\tfor (short i = 0; i < PSIZE; i++)\n\t\t\tsource[i] = i;\n\t\tfor (int i = PSIZE - 1; i >= 0; i--) {\n\t\t\tseed = seed * 6364136223846793005L + 1442695040888963407L;\n\t\t\tint r = (int)((seed + 31) % (i + 1));\n\t\t\tif (r < 0)\n\t\t\t\tr += (i + 1);\n\t\t\tperm[i] = source[r];\n\t\t\tpermGrad2[i] = GRADIENTS_2D[perm[i]];\n\t\t\tpermGrad3[i] = GRADIENTS_3D[perm[i]];\n\t\t\tpermGrad4[i] = GRADIENTS_4D[perm[i]];\n\t\t\tsource[r] = source[i];\n\t\t}\n\t}\n\t\n\t/*\n\t * Noise Evaluators\n\t */\n\t\n\t/**\n\t * 2D SuperSimplex noise, standard lattice orientation.\n\t */\n\tpublic double noise2(double x, double y) {\n\t\t\n\t\t// Get points for A2* lattice\n\t\tdouble s = 0.366025403784439 * (x + y);\n\t\tdouble xs = x + s, ys = y + s;\n\t\t\n\t\treturn noise2_Base(xs, ys);\n\t}\n\t\n\t/**\n\t * 2D SuperSimplex noise, with Y pointing down the main diagonal.\n\t * Might be better for a 2D sandbox style game, where Y is vertical.\n\t * Probably slightly less optimal for heightmaps or continent maps.\n\t */\n\tpublic double noise2_XBeforeY(double x, double y) {\n\t\t\n\t\t// Skew transform and rotation baked into one.\n\t\tdouble xx = x * 0.7071067811865476;\n\t\tdouble yy = y * 1.224744871380249;\n\t\t\n\t\treturn noise2_Base(yy + xx, yy - xx);\n\t}\n\t\n\t/**\n\t * 2D SuperSimplex noise base.\n\t * Lookup table implementation inspired by DigitalShadow.\n\t */\n\tprivate double noise2_Base(double xs, double ys) {\n\t\tdouble value = 0;\n\t\t\n\t\t// Get base points and offsets\n\t\tint xsb = fastFloor(xs), ysb = fastFloor(ys);\n\t\tdouble xsi = xs - xsb, ysi = ys - ysb;\n\t\t\n\t\t// Index to point list\n\t\tint a = (int)(xsi + ysi);\n\t\tint index =\n\t\t\t(a << 2) |\n\t\t\t(int)(xsi - ysi / 2 + 1 - a / 2.0) << 3 |\n\t\t\t(int)(ysi - xsi / 2 + 1 - a / 2.0) << 4;\n\t\t\n\t\tdouble ssi = (xsi + ysi) * -0.211324865405187;\n\t\tdouble xi = xsi + ssi, yi = ysi + ssi;\n\n\t\t// Point contributions\n\t\tfor (int i = 0; i < 4; i++) {\n\t\t\tLatticePoint2D c = LOOKUP_2D[index + i];\n\n\t\t\tdouble dx = xi + c.dx, dy = yi + c.dy;\n\t\t\tdouble attn = 2.0 / 3.0 - dx * dx - dy * dy;\n\t\t\tif (attn <= 0) continue;\n\n\t\t\tint pxm = (xsb + c.xsv) & PMASK, pym = (ysb + c.ysv) & PMASK;\n\t\t\tGrad2 grad = permGrad2[perm[pxm] ^ pym];\n\t\t\tdouble extrapolation = grad.dx * dx + grad.dy * dy;\n\t\t\t\n\t\t\tattn *= attn;\n\t\t\tvalue += attn * attn * extrapolation;\n\t\t}\n\t\t\n\t\treturn value;\n\t}\n\t\n\t/**\n\t * 3D Re-oriented 8-point BCC noise, classic orientation\n\t * Proper substitute for what 3D SuperSimplex would be,\n\t * in light of Forbidden Formulae.\n\t * Use noise3_XYBeforeZ or noise3_XZBeforeY instead, wherever appropriate.\n\t */\n\tpublic double noise3_Classic(double x, double y, double z) {\n\t\t\n\t\t// Re-orient the cubic lattices via rotation, to produce the expected look on cardinal planar slices.\n\t\t// If texturing objects that don't tend to have cardinal plane faces, you could even remove this.\n\t\t// Orthonormal rotation. Not a skew transform.\n\t\tdouble r = (2.0 / 3.0) * (x + y + z);\n\t\tdouble xr = r - x, yr = r - y, zr = r - z;\n\t\t\n\t\t// Evaluate both lattices to form a BCC lattice.\n\t\treturn noise3_BCC(xr, yr, zr);\n\t}\n\t\n\t/**\n\t * 3D Re-oriented 8-point BCC noise, with better visual isotropy in (X, Y).\n\t * Recommended for 3D terrain and time-varied animations.\n\t * The Z coordinate should always be the \"different\" coordinate in your use case.\n\t * If Y is vertical in world coordinates, call noise3_XYBeforeZ(x, z, Y) or use noise3_XZBeforeY.\n\t * If Z is vertical in world coordinates, call noise3_XYBeforeZ(x, y, Z).\n\t * For a time varied animation, call noise3_XYBeforeZ(x, y, T).\n\t */\n\tpublic double noise3_XYBeforeZ(double x, double y, double z) {\n\t\t\n\t\t// Re-orient the cubic lattices without skewing, to make X and Y triangular like 2D.\n\t\t// Orthonormal rotation. Not a skew transform.\n\t\tdouble xy = x + y;\n\t\tdouble s2 = xy * -0.211324865405187;\n\t\tdouble zz = z * 0.577350269189626;\n\t\tdouble xr = x + s2 - zz, yr = y + s2 - zz;\n\t\tdouble zr = xy * 0.577350269189626 + zz;\n\t\t\n\t\t// Evaluate both lattices to form a BCC lattice.\n\t\treturn noise3_BCC(xr, yr, zr);\n\t}\n\t\n\t/**\n\t * 3D Re-oriented 8-point BCC noise, with better visual isotropy in (X, Z).\n\t * Recommended for 3D terrain and time-varied animations.\n\t * The Y coordinate should always be the \"different\" coordinate in your use case.\n\t * If Y is vertical in world coordinates, call noise3_XZBeforeY(x, Y, z).\n\t * If Z is vertical in world coordinates, call noise3_XZBeforeY(x, Z, y) or use noise3_XYBeforeZ.\n\t * For a time varied animation, call noise3_XZBeforeY(x, T, y) or use noise3_XYBeforeZ.\n\t */\n\tpublic double noise3_XZBeforeY(double x, double y, double z) {\n\t\t\n\t\t// Re-orient the cubic lattices without skewing, to make X and Z triangular like 2D.\n\t\t// Orthonormal rotation. Not a skew transform.\n\t\tdouble xz = x + z;\n\t\tdouble s2 = xz * -0.211324865405187;\n\t\tdouble yy = y * 0.577350269189626;\n\t\tdouble xr = x + s2 - yy; double zr = z + s2 - yy;\n\t\tdouble yr = xz * 0.577350269189626 + yy;\n\t\t\n\t\t// Evaluate both lattices to form a BCC lattice.\n\t\treturn noise3_BCC(xr, yr, zr);\n\t}\n\t\n\t/**\n\t * Generate overlapping cubic lattices for 3D Re-oriented BCC noise.\n\t * Lookup table implementation inspired by DigitalShadow.\n\t * It was actually faster to narrow down the points in the loop itself,\n\t * than to build up the index with enough info to isolate 8 points.\n\t */\n\tprivate double noise3_BCC(double xr, double yr, double zr) {\n\t\t\n\t\t// Get base and offsets inside cube of first lattice.\n\t\tint xrb = fastFloor(xr), yrb = fastFloor(yr), zrb = fastFloor(zr);\n\t\tdouble xri = xr - xrb, yri = yr - yrb, zri = zr - zrb;\n\t\t\n\t\t// Identify which octant of the cube we're in. This determines which cell\n\t\t// in the other cubic lattice we're in, and also narrows down one point on each.\n\t\tint xht = (int)(xri + 0.5), yht = (int)(yri + 0.5), zht = (int)(zri + 0.5);\n\t\tint index = (xht << 0) | (yht << 1) | (zht << 2);\n\t\t\n\t\t// Point contributions\n\t\tdouble value = 0;\n\t\tLatticePoint3D c = LOOKUP_3D[index];\n\t\twhile (c != null) {\n\t\t\tdouble dxr = xri + c.dxr, dyr = yri + c.dyr, dzr = zri + c.dzr;\n\t\t\tdouble attn = 0.75 - dxr * dxr - dyr * dyr - dzr * dzr;\n\t\t\tif (attn < 0) {\n\t\t\t\tc = c.nextOnFailure;\n\t\t\t} else {\n\t\t\t\tint pxm = (xrb + c.xrv) & PMASK, pym = (yrb + c.yrv) & PMASK, pzm = (zrb + c.zrv) & PMASK;\n\t\t\t\tGrad3 grad = permGrad3[perm[perm[pxm] ^ pym] ^ pzm];\n\t\t\t\tdouble extrapolation = grad.dx * dxr + grad.dy * dyr + grad.dz * dzr;\n\t\t\t\t\n\t\t\t\tattn *= attn;\n\t\t\t\tvalue += attn * attn * extrapolation;\n\t\t\t\tc = c.nextOnSuccess;\n\t\t\t}\n\t\t}\n\t\treturn value;\n\t}\n\t\n\t/**\n\t * 4D SuperSimplex noise, classic lattice orientation.\n\t */\n\tpublic double noise4_Classic(double x, double y, double z, double w) {\n\t\t\n\t\t// Get points for A4 lattice\n\t\tdouble s = 0.309016994374947 * (x + y + z + w);\n\t\tdouble xs = x + s, ys = y + s, zs = z + s, ws = w + s;\n\t\t\n\t\treturn noise4_Base(xs, ys, zs, ws);\n\t}\n\t\n\t/**\n\t * 4D SuperSimplex noise, with XY and ZW forming orthogonal triangular-based planes.\n\t * Recommended for 3D terrain, where X and Y (or Z and W) are horizontal.\n\t * Recommended for noise(x, y, sin(time), cos(time)) trick.\n\t */\n\tpublic double noise4_XYBeforeZW(double x, double y, double z, double w) {\n\t\t\n\t\tdouble s2 = (x + y) * -0.28522513987434876941 + (z + w) * 0.83897065470611435718;\n\t\tdouble t2 = (z + w) * 0.21939749883706435719 + (x + y) * -0.48214856493302476942;\n\t\tdouble xs = x + s2, ys = y + s2, zs = z + t2, ws = w + t2;\n\t\t\n\t\treturn noise4_Base(xs, ys, zs, ws);\n\t}\n\t\n\t/**\n\t * 4D SuperSimplex noise, with XZ and YW forming orthogonal triangular-based planes.\n\t * Recommended for 3D terrain, where X and Z (or Y and W) are horizontal.\n\t */\n\tpublic double noise4_XZBeforeYW(double x, double y, double z, double w) {\n\t\t\n\t\tdouble s2 = (x + z) * -0.28522513987434876941 + (y + w) * 0.83897065470611435718;\n\t\tdouble t2 = (y + w) * 0.21939749883706435719 + (x + z) * -0.48214856493302476942;\n\t\tdouble xs = x + s2, ys = y + t2, zs = z + s2, ws = w + t2;\n\t\t\n\t\treturn noise4_Base(xs, ys, zs, ws);\n\t}\n\t\n\t/**\n\t * 4D SuperSimplex noise, with XYZ oriented like noise3_Classic,\n\t * and W for an extra degree of freedom.\n\t * Recommended for time-varied animations which texture a 3D object (W=time)\n\t */\n\tpublic double noise4_XYZBeforeW(double x, double y, double z, double w) {\n\t\t\n\t\tdouble xyz = x + y + z;\n\t\tdouble ww = w * 1.118033988749894;\n\t\tdouble s2 = xyz * -0.16666666666666666 + ww;\n\t\tdouble xs = x + s2, ys = y + s2, zs = z + s2, ws = -0.5 * xyz + ww;\n\t\t\n\t\treturn noise4_Base(xs, ys, zs, ws);\n\t}\n\t\n\t/**\n\t * 4D SuperSimplex noise base.\n\t * Using ultra-simple 4x4x4x4 lookup partitioning.\n\t * This isn't as elegant or SIMD/GPU/etc. portable as other approaches,\n\t * but it does compete performance-wise with optimized OpenSimplex1.\n\t */\n\tprivate double noise4_Base(double xs, double ys, double zs, double ws) {\n\t\tdouble value = 0;\n\t\t\n\t\t// Get base points and offsets\n\t\tint xsb = fastFloor(xs), ysb = fastFloor(ys), zsb = fastFloor(zs), wsb = fastFloor(ws);\n\t\tdouble xsi = xs - xsb, ysi = ys - ysb, zsi = zs - zsb, wsi = ws - wsb;\n\t\t\n\t\t// Unskewed offsets\n\t\tdouble ssi = (xsi + ysi + zsi + wsi) * -0.138196601125011;\n\t\tdouble xi = xsi + ssi, yi = ysi + ssi, zi = zsi + ssi, wi = wsi + ssi;\n\t\t\t\n\t\tint index = ((fastFloor(xs * 4) & 3) << 0)\n\t\t\t| ((fastFloor(ys * 4) & 3) << 2)\n\t\t\t| ((fastFloor(zs * 4) & 3) << 4)\n\t\t\t| ((fastFloor(ws * 4) & 3) << 6);\n\t\t\n\t\t// Point contributions\n\t\tfor (LatticePoint4D c : LOOKUP_4D[index]) {\n\t\t\tdouble dx = xi + c.dx, dy = yi + c.dy, dz = zi + c.dz, dw = wi + c.dw;\n\t\t\tdouble attn = 0.8 - dx * dx - dy * dy - dz * dz - dw * dw;\n\t\t\tif (attn > 0) {\n\t\t\t\tattn *= attn;\n\n\t\t\t\tint pxm = (xsb + c.xsv) & PMASK, pym = (ysb + c.ysv) & PMASK;\n\t\t\t\tint pzm = (zsb + c.zsv) & PMASK, pwm = (wsb + c.wsv) & PMASK;\n\t\t\t\tGrad4 grad = permGrad4[perm[perm[perm[pxm] ^ pym] ^ pzm] ^ pwm];\n\t\t\t\tdouble extrapolation = grad.dx * dx + grad.dy * dy + grad.dz * dz + grad.dw * dw;\n\t\t\t\t\n\t\t\t\tvalue += attn * attn * extrapolation;\n\t\t\t}\n\t\t}\n\t\treturn value;\n\t}\n\t\n\t/*\n\t * Utility\n\t */\n\t\n\tprivate static int fastFloor(double x) {\n\t\tint xi = (int)x;\n\t\treturn x < xi ? xi - 1 : xi;\n\t}\n\t\n\t/*\n\t * Definitions\n\t */\n\n\tprivate static final LatticePoint2D[] LOOKUP_2D;\n\tprivate static final LatticePoint3D[] LOOKUP_3D;\n\tprivate static final LatticePoint4D[][] LOOKUP_4D;\n\tstatic {\n\t\tLOOKUP_2D = new LatticePoint2D[8 * 4];\n\t\tLOOKUP_3D = new LatticePoint3D[8];\n\t\tLOOKUP_4D = new LatticePoint4D[256][];\n\t\t\n\t\tfor (int i = 0; i < 8; i++) {\n\t\t\tint i1, j1, i2, j2;\n\t\t\tif ((i & 1) == 0) {\n\t\t\t\tif ((i & 2) == 0) { i1 = -1; j1 = 0; } else { i1 = 1; j1 = 0; }\n\t\t\t\tif ((i & 4) == 0) { i2 = 0; j2 = -1; } else { i2 = 0; j2 = 1; }\n\t\t\t} else {\n\t\t\t\tif ((i & 2) != 0) { i1 = 2; j1 = 1; } else { i1 = 0; j1 = 1; }\n\t\t\t\tif ((i & 4) != 0) { i2 = 1; j2 = 2; } else { i2 = 1; j2 = 0; }\n\t\t\t}\n\t\t\tLOOKUP_2D[i * 4 + 0] = new LatticePoint2D(0, 0);\n\t\t\tLOOKUP_2D[i * 4 + 1] = new LatticePoint2D(1, 1);\n\t\t\tLOOKUP_2D[i * 4 + 2] = new LatticePoint2D(i1, j1);\n\t\t\tLOOKUP_2D[i * 4 + 3] = new LatticePoint2D(i2, j2);\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < 8; i++) {\n\t\t\tint i1, j1, k1, i2, j2, k2;\n\t\t\ti1 = (i >> 0) & 1; j1 = (i >> 1) & 1; k1 = (i >> 2) & 1;\n\t\t\ti2 = i1 ^ 1; j2 = j1 ^ 1; k2 = k1 ^ 1;\n\t\t\t\n\t\t\t// The two points within this octant, one from each of the two cubic half-lattices.\n\t\t\tLatticePoint3D c0 = new LatticePoint3D(i1, j1, k1, 0);\n\t\t\tLatticePoint3D c1 = new LatticePoint3D(i1 + i2, j1 + j2, k1 + k2, 1);\n\t\t\t\n\t\t\t// (1, 0, 0) vs (0, 1, 1) away from octant.\n\t\t\tLatticePoint3D c2 = new LatticePoint3D(i1 ^ 1, j1, k1, 0);\n\t\t\tLatticePoint3D c3 = new LatticePoint3D(i1, j1 ^ 1, k1 ^ 1, 0);\n\t\t\t\n\t\t\t// (1, 0, 0) vs (0, 1, 1) away from octant, on second half-lattice.\n\t\t\tLatticePoint3D c4 = new LatticePoint3D(i1 + (i2 ^ 1), j1 + j2, k1 + k2, 1);\n\t\t\tLatticePoint3D c5 = new LatticePoint3D(i1 + i2, j1 + (j2 ^ 1), k1 + (k2 ^ 1), 1);\n\t\t\t\n\t\t\t// (0, 1, 0) vs (1, 0, 1) away from octant.\n\t\t\tLatticePoint3D c6 = new LatticePoint3D(i1, j1 ^ 1, k1, 0);\n\t\t\tLatticePoint3D c7 = new LatticePoint3D(i1 ^ 1, j1, k1 ^ 1, 0);\n\t\t\t\n\t\t\t// (0, 1, 0) vs (1, 0, 1) away from octant, on second half-lattice.\n\t\t\tLatticePoint3D c8 = new LatticePoint3D(i1 + i2, j1 + (j2 ^ 1), k1 + k2, 1);\n\t\t\tLatticePoint3D c9 = new LatticePoint3D(i1 + (i2 ^ 1), j1 + j2, k1 + (k2 ^ 1), 1);\n\t\t\t\n\t\t\t// (0, 0, 1) vs (1, 1, 0) away from octant.\n\t\t\tLatticePoint3D cA = new LatticePoint3D(i1, j1, k1 ^ 1, 0);\n\t\t\tLatticePoint3D cB = new LatticePoint3D(i1 ^ 1, j1 ^ 1, k1, 0);\n\t\t\t\n\t\t\t// (0, 0, 1) vs (1, 1, 0) away from octant, on second half-lattice.\n\t\t\tLatticePoint3D cC = new LatticePoint3D(i1 + i2, j1 + j2, k1 + (k2 ^ 1), 1);\n\t\t\tLatticePoint3D cD = new LatticePoint3D(i1 + (i2 ^ 1), j1 + (j2 ^ 1), k1 + k2, 1);\n\t\t\t\n\t\t\t// First two points are guaranteed.\n\t\t\tc0.nextOnFailure = c0.nextOnSuccess = c1;\n\t\t\tc1.nextOnFailure = c1.nextOnSuccess = c2;\n\t\t\t\n\t\t\t// If c2 is in range, then we know c3 and c4 are not.\n\t\t\tc2.nextOnFailure = c3; c2.nextOnSuccess = c5;\n\t\t\tc3.nextOnFailure = c4; c3.nextOnSuccess = c4;\n\t\t\t\n\t\t\t// If c4 is in range, then we know c5 is not.\n\t\t\tc4.nextOnFailure = c5; c4.nextOnSuccess = c6;\n\t\t\tc5.nextOnFailure = c5.nextOnSuccess = c6;\n\t\t\t\n\t\t\t// If c6 is in range, then we know c7 and c8 are not.\n\t\t\tc6.nextOnFailure = c7; c6.nextOnSuccess = c9;\n\t\t\tc7.nextOnFailure = c8; c7.nextOnSuccess = c8;\n\t\t\t\n\t\t\t// If c8 is in range, then we know c9 is not.\n\t\t\tc8.nextOnFailure = c9; c8.nextOnSuccess = cA;\n\t\t\tc9.nextOnFailure = c9.nextOnSuccess = cA;\n\t\t\t\n\t\t\t// If cA is in range, then we know cB and cC are not.\n\t\t\tcA.nextOnFailure = cB; cA.nextOnSuccess = cD;\n\t\t\tcB.nextOnFailure = cC; cB.nextOnSuccess = cC;\n\t\t\t\n\t\t\t// If cC is in range, then we know cD is not.\n\t\t\tcC.nextOnFailure = cD; cC.nextOnSuccess = null;\n\t\t\tcD.nextOnFailure = cD.nextOnSuccess = null;\n\t\t\t\n\t\t\tLOOKUP_3D[i] = c0;\n\t\t}\n\t\t\n\t\tint[][] lookup4DPregen = {\n\t\t\t{ 0x15, 0x45, 0x51, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x15, 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xAA },\n\t\t\t{ 0x01, 0x05, 0x11, 0x15, 0x41, 0x45, 0x51, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA },\n\t\t\t{ 0x01, 0x15, 0x16, 0x45, 0x46, 0x51, 0x52, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n\t\t\t{ 0x15, 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA9, 0xAA },\n\t\t\t{ 0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xAA },\n\t\t\t{ 0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xAA },\n\t\t\t{ 0x05, 0x15, 0x16, 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xAA, 0xAB },\n\t\t\t{ 0x04, 0x05, 0x14, 0x15, 0x44, 0x45, 0x54, 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA },\n\t\t\t{ 0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xAA },\n\t\t\t{ 0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x9A, 0xAA },\n\t\t\t{ 0x05, 0x15, 0x16, 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x5B, 0x6A, 0x9A, 0xAA, 0xAB },\n\t\t\t{ 0x04, 0x15, 0x19, 0x45, 0x49, 0x54, 0x55, 0x58, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x05, 0x15, 0x19, 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xAA, 0xAE },\n\t\t\t{ 0x05, 0x15, 0x19, 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x5E, 0x6A, 0x9A, 0xAA, 0xAE },\n\t\t\t{ 0x05, 0x15, 0x1A, 0x45, 0x4A, 0x55, 0x56, 0x59, 0x5A, 0x5B, 0x5E, 0x6A, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n\t\t\t{ 0x15, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0xA5, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x11, 0x15, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xAA },\n\t\t\t{ 0x11, 0x15, 0x51, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x96, 0xA6, 0xAA },\n\t\t\t{ 0x11, 0x15, 0x16, 0x51, 0x52, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x96, 0xA6, 0xAA, 0xAB },\n\t\t\t{ 0x14, 0x15, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA9, 0xAA },\n\t\t\t{ 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x9A, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n\t\t\t{ 0x15, 0x16, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x6B, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n\t\t\t{ 0x14, 0x15, 0x54, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x99, 0xA9, 0xAA },\n\t\t\t{ 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x9A, 0xAA },\n\t\t\t{ 0x15, 0x16, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x6B, 0x9A, 0xAA, 0xAB },\n\t\t\t{ 0x14, 0x15, 0x19, 0x54, 0x55, 0x58, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x99, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x15, 0x19, 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x6E, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x15, 0x19, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x6E, 0x9A, 0xAA, 0xAE },\n\t\t\t{ 0x15, 0x1A, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x6B, 0x6E, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n\t\t\t{ 0x10, 0x11, 0x14, 0x15, 0x50, 0x51, 0x54, 0x55, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x11, 0x15, 0x51, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xAA },\n\t\t\t{ 0x11, 0x15, 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0xA6, 0xAA },\n\t\t\t{ 0x11, 0x15, 0x16, 0x51, 0x52, 0x55, 0x56, 0x65, 0x66, 0x67, 0x6A, 0xA6, 0xAA, 0xAB },\n\t\t\t{ 0x14, 0x15, 0x54, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA9, 0xAA },\n\t\t\t{ 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n\t\t\t{ 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA6, 0xAA },\n\t\t\t{ 0x15, 0x16, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x6B, 0xA6, 0xAA, 0xAB },\n\t\t\t{ 0x14, 0x15, 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0xA9, 0xAA },\n\t\t\t{ 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA9, 0xAA },\n\t\t\t{ 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xAA },\n\t\t\t{ 0x15, 0x16, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6B, 0xAA, 0xAB },\n\t\t\t{ 0x14, 0x15, 0x19, 0x54, 0x55, 0x58, 0x59, 0x65, 0x69, 0x6A, 0x6D, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x15, 0x19, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x6E, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x15, 0x19, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6E, 0xAA, 0xAE },\n\t\t\t{ 0x15, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x69, 0x6A, 0x6B, 0x6E, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n\t\t\t{ 0x10, 0x15, 0x25, 0x51, 0x54, 0x55, 0x61, 0x64, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n\t\t\t{ 0x11, 0x15, 0x25, 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xAA, 0xBA },\n\t\t\t{ 0x11, 0x15, 0x25, 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x6A, 0x76, 0xA6, 0xAA, 0xBA },\n\t\t\t{ 0x11, 0x15, 0x26, 0x51, 0x55, 0x56, 0x62, 0x65, 0x66, 0x67, 0x6A, 0x76, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n\t\t\t{ 0x14, 0x15, 0x25, 0x54, 0x55, 0x59, 0x64, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA9, 0xAA, 0xBA },\n\t\t\t{ 0x15, 0x25, 0x55, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n\t\t\t{ 0x15, 0x25, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xA6, 0xAA, 0xBA },\n\t\t\t{ 0x15, 0x26, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x6B, 0x7A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n\t\t\t{ 0x14, 0x15, 0x25, 0x54, 0x55, 0x59, 0x64, 0x65, 0x69, 0x6A, 0x79, 0xA9, 0xAA, 0xBA },\n\t\t\t{ 0x15, 0x25, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xA9, 0xAA, 0xBA },\n\t\t\t{ 0x15, 0x25, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xAA, 0xBA },\n\t\t\t{ 0x15, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6B, 0x7A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n\t\t\t{ 0x14, 0x15, 0x29, 0x54, 0x55, 0x59, 0x65, 0x68, 0x69, 0x6A, 0x6D, 0x79, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n\t\t\t{ 0x15, 0x29, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x6E, 0x7A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n\t\t\t{ 0x15, 0x55, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6E, 0x7A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n\t\t\t{ 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6B, 0x6E, 0x7A, 0xAA, 0xAB, 0xAE, 0xBA, 0xBF },\n\t\t\t{ 0x45, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x41, 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xAA },\n\t\t\t{ 0x41, 0x45, 0x51, 0x55, 0x56, 0x5A, 0x66, 0x95, 0x96, 0x9A, 0xA6, 0xAA },\n\t\t\t{ 0x41, 0x45, 0x46, 0x51, 0x52, 0x55, 0x56, 0x5A, 0x66, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n\t\t\t{ 0x44, 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA9, 0xAA },\n\t\t\t{ 0x45, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x45, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xAB },\n\t\t\t{ 0x45, 0x46, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB },\n\t\t\t{ 0x44, 0x45, 0x54, 0x55, 0x59, 0x5A, 0x69, 0x95, 0x99, 0x9A, 0xA9, 0xAA },\n\t\t\t{ 0x45, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xAA },\n\t\t\t{ 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x96, 0x9A, 0x9B, 0xAA, 0xAB },\n\t\t\t{ 0x44, 0x45, 0x49, 0x54, 0x55, 0x58, 0x59, 0x5A, 0x69, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x45, 0x49, 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x99, 0x9A, 0x9E, 0xAA, 0xAE },\n\t\t\t{ 0x45, 0x4A, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x9A, 0x9B, 0x9E, 0xAA, 0xAB, 0xAE, 0xAF },\n\t\t\t{ 0x50, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x95, 0x96, 0x99, 0xA5, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x59, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xAB },\n\t\t\t{ 0x51, 0x52, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xA7, 0xAA, 0xAB },\n\t\t\t{ 0x54, 0x55, 0x56, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x15, 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n\t\t\t{ 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n\t\t\t{ 0x54, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x15, 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE },\n\t\t\t{ 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n\t\t\t{ 0x54, 0x55, 0x58, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAD, 0xAE },\n\t\t\t{ 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n\t\t\t{ 0x50, 0x51, 0x54, 0x55, 0x65, 0x66, 0x69, 0x95, 0xA5, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xAA },\n\t\t\t{ 0x51, 0x52, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x96, 0xA6, 0xA7, 0xAA, 0xAB },\n\t\t\t{ 0x54, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n\t\t\t{ 0x15, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n\t\t\t{ 0x15, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xBA },\n\t\t\t{ 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n\t\t\t{ 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA9, 0xAA },\n\t\t\t{ 0x15, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xBA },\n\t\t\t{ 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x9A, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n\t\t\t{ 0x54, 0x55, 0x58, 0x59, 0x65, 0x69, 0x6A, 0x99, 0xA9, 0xAA, 0xAD, 0xAE },\n\t\t\t{ 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x15, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x69, 0x6A, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n\t\t\t{ 0x50, 0x51, 0x54, 0x55, 0x61, 0x64, 0x65, 0x66, 0x69, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n\t\t\t{ 0x51, 0x55, 0x61, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x6A, 0xA5, 0xA6, 0xAA, 0xB6, 0xBA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x62, 0x65, 0x66, 0x6A, 0xA6, 0xA7, 0xAA, 0xAB, 0xB6, 0xBA, 0xBB },\n\t\t\t{ 0x54, 0x55, 0x64, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA },\n\t\t\t{ 0x55, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n\t\t\t{ 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n\t\t\t{ 0x55, 0x56, 0x65, 0x66, 0x6A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n\t\t\t{ 0x54, 0x55, 0x59, 0x64, 0x65, 0x69, 0x6A, 0xA5, 0xA9, 0xAA, 0xB9, 0xBA },\n\t\t\t{ 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n\t\t\t{ 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n\t\t\t{ 0x15, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n\t\t\t{ 0x54, 0x55, 0x59, 0x65, 0x68, 0x69, 0x6A, 0xA9, 0xAA, 0xAD, 0xAE, 0xB9, 0xBA, 0xBE },\n\t\t\t{ 0x55, 0x59, 0x65, 0x69, 0x6A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n\t\t\t{ 0x15, 0x55, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n\t\t\t{ 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xAA, 0xAB, 0xAE, 0xBA, 0xBF },\n\t\t\t{ 0x40, 0x41, 0x44, 0x45, 0x50, 0x51, 0x54, 0x55, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x41, 0x45, 0x51, 0x55, 0x56, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xAA },\n\t\t\t{ 0x41, 0x45, 0x51, 0x55, 0x56, 0x95, 0x96, 0x9A, 0xA6, 0xAA },\n\t\t\t{ 0x41, 0x45, 0x46, 0x51, 0x52, 0x55, 0x56, 0x95, 0x96, 0x97, 0x9A, 0xA6, 0xAA, 0xAB },\n\t\t\t{ 0x44, 0x45, 0x54, 0x55, 0x59, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA9, 0xAA },\n\t\t\t{ 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n\t\t\t{ 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA },\n\t\t\t{ 0x45, 0x46, 0x55, 0x56, 0x5A, 0x95, 0x96, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB },\n\t\t\t{ 0x44, 0x45, 0x54, 0x55, 0x59, 0x95, 0x99, 0x9A, 0xA9, 0xAA },\n\t\t\t{ 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA },\n\t\t\t{ 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xAA },\n\t\t\t{ 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9B, 0xAA, 0xAB },\n\t\t\t{ 0x44, 0x45, 0x49, 0x54, 0x55, 0x58, 0x59, 0x95, 0x99, 0x9A, 0x9D, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x45, 0x49, 0x55, 0x59, 0x5A, 0x95, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9E, 0xAA, 0xAE },\n\t\t\t{ 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x96, 0x99, 0x9A, 0x9B, 0x9E, 0xAA, 0xAB, 0xAE, 0xAF },\n\t\t\t{ 0x50, 0x51, 0x54, 0x55, 0x65, 0x95, 0x96, 0x99, 0xA5, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA },\n\t\t\t{ 0x51, 0x52, 0x55, 0x56, 0x66, 0x95, 0x96, 0x9A, 0xA6, 0xA7, 0xAA, 0xAB },\n\t\t\t{ 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n\t\t\t{ 0x45, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n\t\t\t{ 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xEA },\n\t\t\t{ 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n\t\t\t{ 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA },\n\t\t\t{ 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xEA },\n\t\t\t{ 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x45, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xAB },\n\t\t\t{ 0x54, 0x55, 0x58, 0x59, 0x69, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAD, 0xAE },\n\t\t\t{ 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x45, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x96, 0x99, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n\t\t\t{ 0x50, 0x51, 0x54, 0x55, 0x65, 0x95, 0xA5, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xAA },\n\t\t\t{ 0x51, 0x52, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB },\n\t\t\t{ 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xAB },\n\t\t\t{ 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA },\n\t\t\t{ 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n\t\t\t{ 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB },\n\t\t\t{ 0x54, 0x55, 0x58, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE },\n\t\t\t{ 0x54, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAE },\n\t\t\t{ 0x55, 0x56, 0x59, 0x5A, 0x66, 0x69, 0x6A, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xAF },\n\t\t\t{ 0x50, 0x51, 0x54, 0x55, 0x61, 0x64, 0x65, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xB5, 0xBA },\n\t\t\t{ 0x51, 0x55, 0x61, 0x65, 0x66, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0xB6, 0xBA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x96, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB, 0xB6, 0xBA, 0xBB },\n\t\t\t{ 0x54, 0x55, 0x64, 0x65, 0x69, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA },\n\t\t\t{ 0x55, 0x65, 0x66, 0x69, 0x6A, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x96, 0xA5, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n\t\t\t{ 0x54, 0x55, 0x59, 0x64, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xB9, 0xBA },\n\t\t\t{ 0x54, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n\t\t\t{ 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n\t\t\t{ 0x55, 0x56, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xBA, 0xBB },\n\t\t\t{ 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x99, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE, 0xB9, 0xBA, 0xBE },\n\t\t\t{ 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x99, 0xA5, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n\t\t\t{ 0x55, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n\t\t\t{ 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xBA },\n\t\t\t{ 0x40, 0x45, 0x51, 0x54, 0x55, 0x85, 0x91, 0x94, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n\t\t\t{ 0x41, 0x45, 0x51, 0x55, 0x56, 0x85, 0x91, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xAA, 0xEA },\n\t\t\t{ 0x41, 0x45, 0x51, 0x55, 0x56, 0x85, 0x91, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xD6, 0xEA },\n\t\t\t{ 0x41, 0x45, 0x51, 0x55, 0x56, 0x86, 0x92, 0x95, 0x96, 0x97, 0x9A, 0xA6, 0xAA, 0xAB, 0xD6, 0xEA, 0xEB },\n\t\t\t{ 0x44, 0x45, 0x54, 0x55, 0x59, 0x85, 0x94, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xEA },\n\t\t\t{ 0x45, 0x55, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xDA, 0xEA },\n\t\t\t{ 0x45, 0x55, 0x56, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xDA, 0xEA },\n\t\t\t{ 0x45, 0x55, 0x56, 0x86, 0x95, 0x96, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB, 0xDA, 0xEA, 0xEB },\n\t\t\t{ 0x44, 0x45, 0x54, 0x55, 0x59, 0x85, 0x94, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xD9, 0xEA },\n\t\t\t{ 0x45, 0x55, 0x59, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xDA, 0xEA },\n\t\t\t{ 0x45, 0x55, 0x56, 0x59, 0x5A, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xAA, 0xDA, 0xEA },\n\t\t\t{ 0x45, 0x55, 0x56, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB, 0xDA, 0xEA, 0xEB },\n\t\t\t{ 0x44, 0x45, 0x54, 0x55, 0x59, 0x89, 0x95, 0x98, 0x99, 0x9A, 0x9D, 0xA9, 0xAA, 0xAE, 0xD9, 0xEA, 0xEE },\n\t\t\t{ 0x45, 0x55, 0x59, 0x89, 0x95, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE, 0xDA, 0xEA, 0xEE },\n\t\t\t{ 0x45, 0x55, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE, 0xDA, 0xEA, 0xEE },\n\t\t\t{ 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9B, 0x9E, 0xAA, 0xAB, 0xAE, 0xDA, 0xEA, 0xEF },\n\t\t\t{ 0x50, 0x51, 0x54, 0x55, 0x65, 0x91, 0x94, 0x95, 0x96, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n\t\t\t{ 0x51, 0x55, 0x91, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xE6, 0xEA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x91, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xE6, 0xEA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x92, 0x95, 0x96, 0x9A, 0xA6, 0xA7, 0xAA, 0xAB, 0xE6, 0xEA, 0xEB },\n\t\t\t{ 0x54, 0x55, 0x94, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xE9, 0xEA },\n\t\t\t{ 0x55, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n\t\t\t{ 0x55, 0x56, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n\t\t\t{ 0x55, 0x56, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB, 0xEA, 0xEB },\n\t\t\t{ 0x54, 0x55, 0x59, 0x94, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xE9, 0xEA },\n\t\t\t{ 0x55, 0x59, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n\t\t\t{ 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n\t\t\t{ 0x45, 0x55, 0x56, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xAB, 0xEA, 0xEB },\n\t\t\t{ 0x54, 0x55, 0x59, 0x95, 0x98, 0x99, 0x9A, 0xA9, 0xAA, 0xAD, 0xAE, 0xE9, 0xEA, 0xEE },\n\t\t\t{ 0x55, 0x59, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE },\n\t\t\t{ 0x45, 0x55, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE },\n\t\t\t{ 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xAA, 0xAB, 0xAE, 0xEA, 0xEF },\n\t\t\t{ 0x50, 0x51, 0x54, 0x55, 0x65, 0x91, 0x94, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xE5, 0xEA },\n\t\t\t{ 0x51, 0x55, 0x65, 0x91, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xE6, 0xEA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x65, 0x66, 0x91, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0xE6, 0xEA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x66, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB, 0xE6, 0xEA, 0xEB },\n\t\t\t{ 0x54, 0x55, 0x65, 0x94, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xE9, 0xEA },\n\t\t\t{ 0x55, 0x65, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x66, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xAB, 0xEA, 0xEB },\n\t\t\t{ 0x54, 0x55, 0x59, 0x65, 0x69, 0x94, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xE9, 0xEA },\n\t\t\t{ 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n\t\t\t{ 0x55, 0x56, 0x59, 0x65, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n\t\t\t{ 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xEA, 0xEB },\n\t\t\t{ 0x54, 0x55, 0x59, 0x69, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE, 0xE9, 0xEA, 0xEE },\n\t\t\t{ 0x54, 0x55, 0x59, 0x69, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE },\n\t\t\t{ 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE },\n\t\t\t{ 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xEA },\n\t\t\t{ 0x50, 0x51, 0x54, 0x55, 0x65, 0x95, 0xA1, 0xA4, 0xA5, 0xA6, 0xA9, 0xAA, 0xB5, 0xBA, 0xE5, 0xEA, 0xFA },\n\t\t\t{ 0x51, 0x55, 0x65, 0x95, 0xA1, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA, 0xE6, 0xEA, 0xFA },\n\t\t\t{ 0x51, 0x55, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA, 0xE6, 0xEA, 0xFA },\n\t\t\t{ 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB, 0xB6, 0xBA, 0xE6, 0xEA, 0xFB },\n\t\t\t{ 0x54, 0x55, 0x65, 0x95, 0xA4, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA, 0xE9, 0xEA, 0xFA },\n\t\t\t{ 0x55, 0x65, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA },\n\t\t\t{ 0x51, 0x55, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA },\n\t\t\t{ 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0xAB, 0xBA, 0xEA, 0xFB },\n\t\t\t{ 0x54, 0x55, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA, 0xE9, 0xEA, 0xFA },\n\t\t\t{ 0x54, 0x55, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA },\n\t\t\t{ 0x55, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA },\n\t\t\t{ 0x55, 0x56, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xBA, 0xEA },\n\t\t\t{ 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE, 0xB9, 0xBA, 0xE9, 0xEA, 0xFE },\n\t\t\t{ 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xAE, 0xBA, 0xEA, 0xFE },\n\t\t\t{ 0x55, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xBA, 0xEA },\n\t\t\t{ 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xBA, 0xEA },\n\t\t};\n\t\tLatticePoint4D[] latticePoints = new LatticePoint4D[256];\n\t\tfor (int i = 0; i < 256; i++) {\n\t\t\tint cx = ((i >> 0) & 3) - 1;\n\t\t\tint cy = ((i >> 2) & 3) - 1;\n\t\t\tint cz = ((i >> 4) & 3) - 1;\n\t\t\tint cw = ((i >> 6) & 3) - 1;\n\t\t\tlatticePoints[i] = new LatticePoint4D(cx, cy, cz, cw);\n\t\t}\n\t\tfor (int i = 0; i < 256; i++) {\n\t\t\tLOOKUP_4D[i] = new LatticePoint4D[lookup4DPregen[i].length];\n\t\t\tfor (int j = 0; j < lookup4DPregen[i].length; j++) {\n\t\t\t\tLOOKUP_4D[i][j] = latticePoints[lookup4DPregen[i][j]];\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprivate static class LatticePoint2D {\n\t\tint xsv, ysv;\n\t\tdouble dx, dy;\n\t\tpublic LatticePoint2D(int xsv, int ysv) {\n\t\t\tthis.xsv = xsv; this.ysv = ysv;\n\t\t\tdouble ssv = (xsv + ysv) * -0.211324865405187;\n\t\t\tthis.dx = -xsv - ssv;\n\t\t\tthis.dy = -ysv - ssv;\n\t\t}\n\t}\n\t\n\tprivate static class LatticePoint3D {\n\t\tpublic double dxr, dyr, dzr;\n\t\tpublic int xrv, yrv, zrv;\n\t\tLatticePoint3D nextOnFailure, nextOnSuccess;\n\t\tpublic LatticePoint3D(int xrv, int yrv, int zrv, int lattice) {\n\t\t\tthis.dxr = -xrv + lattice * 0.5; this.dyr = -yrv + lattice * 0.5; this.dzr = -zrv + lattice * 0.5;\n\t\t\tthis.xrv = xrv + lattice * 1024; this.yrv = yrv + lattice * 1024; this.zrv = zrv + lattice * 1024;\n\t\t}\n\t}\n\t\n\tprivate static class LatticePoint4D {\n\t\tint xsv, ysv, zsv, wsv;\n\t\tdouble dx, dy, dz, dw;\n\t\tpublic LatticePoint4D(int xsv, int ysv, int zsv, int wsv) {\n\t\t\tthis.xsv = xsv; this.ysv = ysv; this.zsv = zsv; this.wsv = wsv;\n\t\t\tdouble ssv = (xsv + ysv + zsv + wsv) * -0.138196601125011;\n\t\t\tthis.dx = -xsv - ssv;\n\t\t\tthis.dy = -ysv - ssv;\n\t\t\tthis.dz = -zsv - ssv;\n\t\t\tthis.dw = -wsv - ssv;\n\t\t}\n\t}\n\t\n\t/*\n\t * Gradients\n\t */\n\t\n\tprivate static class Grad2 {\n\t\tdouble dx, dy;\n\t\tpublic Grad2(double dx, double dy) {\n\t\t\tthis.dx = dx; this.dy = dy;\n\t\t}\n\t}\n\t\n\tprivate static class Grad3 {\n\t\tdouble dx, dy, dz;\n\t\tpublic Grad3(double dx, double dy, double dz) {\n\t\t\tthis.dx = dx; this.dy = dy; this.dz = dz;\n\t\t}\n\t}\n\t\n\tprivate static class Grad4 {\n\t\tdouble dx, dy, dz, dw;\n\t\tpublic Grad4(double dx, double dy, double dz,  double dw) {\n\t\t\tthis.dx = dx; this.dy = dy; this.dz = dz; this.dw = dw;\n\t\t}\n\t}\n\t\n\tprivate static final double N2 = 0.05481866495625118;\n\tprivate static final double N3 = 0.2781926117527186;\n\tprivate static final double N4 = 0.11127401889945551;\n\tprivate static final Grad2[] GRADIENTS_2D;\n\tprivate static final Grad3[] GRADIENTS_3D;\n\tprivate static final Grad4[] GRADIENTS_4D;\n\tstatic {\n\t\t\n\t\tGRADIENTS_2D = new Grad2[PSIZE];\n\t\tGrad2[] grad2 = {\n\t\t\tnew Grad2( 0.130526192220052,  0.99144486137381),\n\t\t\tnew Grad2( 0.38268343236509,   0.923879532511287),\n\t\t\tnew Grad2( 0.608761429008721,  0.793353340291235),\n\t\t\tnew Grad2( 0.793353340291235,  0.608761429008721),\n\t\t\tnew Grad2( 0.923879532511287,  0.38268343236509),\n\t\t\tnew Grad2( 0.99144486137381,   0.130526192220051),\n\t\t\tnew Grad2( 0.99144486137381,  -0.130526192220051),\n\t\t\tnew Grad2( 0.923879532511287, -0.38268343236509),\n\t\t\tnew Grad2( 0.793353340291235, -0.60876142900872),\n\t\t\tnew Grad2( 0.608761429008721, -0.793353340291235),\n\t\t\tnew Grad2( 0.38268343236509,  -0.923879532511287),\n\t\t\tnew Grad2( 0.130526192220052, -0.99144486137381),\n\t\t\tnew Grad2(-0.130526192220052, -0.99144486137381),\n\t\t\tnew Grad2(-0.38268343236509,  -0.923879532511287),\n\t\t\tnew Grad2(-0.608761429008721, -0.793353340291235),\n\t\t\tnew Grad2(-0.793353340291235, -0.608761429008721),\n\t\t\tnew Grad2(-0.923879532511287, -0.38268343236509),\n\t\t\tnew Grad2(-0.99144486137381,  -0.130526192220052),\n\t\t\tnew Grad2(-0.99144486137381,   0.130526192220051),\n\t\t\tnew Grad2(-0.923879532511287,  0.38268343236509),\n\t\t\tnew Grad2(-0.793353340291235,  0.608761429008721),\n\t\t\tnew Grad2(-0.608761429008721,  0.793353340291235),\n\t\t\tnew Grad2(-0.38268343236509,   0.923879532511287),\n\t\t\tnew Grad2(-0.130526192220052,  0.99144486137381)\n\t\t};\n\t\tfor (int i = 0; i < grad2.length; i++) {\n\t\t\tgrad2[i].dx /= N2; grad2[i].dy /= N2;\n\t\t}\n\t\tfor (int i = 0; i < PSIZE; i++) {\n\t\t\tGRADIENTS_2D[i] = grad2[i % grad2.length];\n\t\t}\n\t\t\n\t\tGRADIENTS_3D = new Grad3[PSIZE];\n\t\tGrad3[] grad3 = {\n\t\t\tnew Grad3(-2.22474487139,      -2.22474487139,      -1.0),\n\t\t\tnew Grad3(-2.22474487139,      -2.22474487139,       1.0),\n\t\t\tnew Grad3(-3.0862664687972017, -1.1721513422464978,  0.0),\n\t\t\tnew Grad3(-1.1721513422464978, -3.0862664687972017,  0.0),\n\t\t\tnew Grad3(-2.22474487139,      -1.0,                -2.22474487139),\n\t\t\tnew Grad3(-2.22474487139,       1.0,                -2.22474487139),\n\t\t\tnew Grad3(-1.1721513422464978,  0.0,                -3.0862664687972017),\n\t\t\tnew Grad3(-3.0862664687972017,  0.0,                -1.1721513422464978),\n\t\t\tnew Grad3(-2.22474487139,      -1.0,                 2.22474487139),\n\t\t\tnew Grad3(-2.22474487139,       1.0,                 2.22474487139),\n\t\t\tnew Grad3(-3.0862664687972017,  0.0,                 1.1721513422464978),\n\t\t\tnew Grad3(-1.1721513422464978,  0.0,                 3.0862664687972017),\n\t\t\tnew Grad3(-2.22474487139,       2.22474487139,      -1.0),\n\t\t\tnew Grad3(-2.22474487139,       2.22474487139,       1.0),\n\t\t\tnew Grad3(-1.1721513422464978,  3.0862664687972017,  0.0),\n\t\t\tnew Grad3(-3.0862664687972017,  1.1721513422464978,  0.0),\n\t\t\tnew Grad3(-1.0,                -2.22474487139,      -2.22474487139),\n\t\t\tnew Grad3( 1.0,                -2.22474487139,      -2.22474487139),\n\t\t\tnew Grad3( 0.0,                -3.0862664687972017, -1.1721513422464978),\n\t\t\tnew Grad3( 0.0,                -1.1721513422464978, -3.0862664687972017),\n\t\t\tnew Grad3(-1.0,                -2.22474487139,       2.22474487139),\n\t\t\tnew Grad3( 1.0,                -2.22474487139,       2.22474487139),\n\t\t\tnew Grad3( 0.0,                -1.1721513422464978,  3.0862664687972017),\n\t\t\tnew Grad3( 0.0,                -3.0862664687972017,  1.1721513422464978),\n\t\t\tnew Grad3(-1.0,                 2.22474487139,      -2.22474487139),\n\t\t\tnew Grad3( 1.0,                 2.22474487139,      -2.22474487139),\n\t\t\tnew Grad3( 0.0,                 1.1721513422464978, -3.0862664687972017),\n\t\t\tnew Grad3( 0.0,                 3.0862664687972017, -1.1721513422464978),\n\t\t\tnew Grad3(-1.0,                 2.22474487139,       2.22474487139),\n\t\t\tnew Grad3( 1.0,                 2.22474487139,       2.22474487139),\n\t\t\tnew Grad3( 0.0,                 3.0862664687972017,  1.1721513422464978),\n\t\t\tnew Grad3( 0.0,                 1.1721513422464978,  3.0862664687972017),\n\t\t\tnew Grad3( 2.22474487139,      -2.22474487139,      -1.0),\n\t\t\tnew Grad3( 2.22474487139,      -2.22474487139,       1.0),\n\t\t\tnew Grad3( 1.1721513422464978, -3.0862664687972017,  0.0),\n\t\t\tnew Grad3( 3.0862664687972017, -1.1721513422464978,  0.0),\n\t\t\tnew Grad3( 2.22474487139,      -1.0,                -2.22474487139),\n\t\t\tnew Grad3( 2.22474487139,       1.0,                -2.22474487139),\n\t\t\tnew Grad3( 3.0862664687972017,  0.0,                -1.1721513422464978),\n\t\t\tnew Grad3( 1.1721513422464978,  0.0,                -3.0862664687972017),\n\t\t\tnew Grad3( 2.22474487139,      -1.0,                 2.22474487139),\n\t\t\tnew Grad3( 2.22474487139,       1.0,                 2.22474487139),\n\t\t\tnew Grad3( 1.1721513422464978,  0.0,                 3.0862664687972017),\n\t\t\tnew Grad3( 3.0862664687972017,  0.0,                 1.1721513422464978),\n\t\t\tnew Grad3( 2.22474487139,       2.22474487139,      -1.0),\n\t\t\tnew Grad3( 2.22474487139,       2.22474487139,       1.0),\n\t\t\tnew Grad3( 3.0862664687972017,  1.1721513422464978,  0.0),\n\t\t\tnew Grad3( 1.1721513422464978,  3.0862664687972017,  0.0)\n\t\t};\n\t\tfor (int i = 0; i < grad3.length; i++) {\n\t\t\tgrad3[i].dx /= N3; grad3[i].dy /= N3; grad3[i].dz /= N3;\n\t\t}\n\t\tfor (int i = 0; i < PSIZE; i++) {\n\t\t\tGRADIENTS_3D[i] = grad3[i % grad3.length];\n\t\t}\n\t\t\n\t\tGRADIENTS_4D = new Grad4[PSIZE];\n\t\tGrad4[] grad4 = {\n\t\t\tnew Grad4(-0.753341017856078,    -0.37968289875261624,  -0.37968289875261624,  -0.37968289875261624),\n\t\t\tnew Grad4(-0.7821684431180708,   -0.4321472685365301,   -0.4321472685365301,    0.12128480194602098),\n\t\t\tnew Grad4(-0.7821684431180708,   -0.4321472685365301,    0.12128480194602098,  -0.4321472685365301),\n\t\t\tnew Grad4(-0.7821684431180708,    0.12128480194602098,  -0.4321472685365301,   -0.4321472685365301),\n\t\t\tnew Grad4(-0.8586508742123365,   -0.508629699630796,     0.044802370851755174,  0.044802370851755174),\n\t\t\tnew Grad4(-0.8586508742123365,    0.044802370851755174, -0.508629699630796,     0.044802370851755174),\n\t\t\tnew Grad4(-0.8586508742123365,    0.044802370851755174,  0.044802370851755174, -0.508629699630796),\n\t\t\tnew Grad4(-0.9982828964265062,   -0.03381941603233842,  -0.03381941603233842,  -0.03381941603233842),\n\t\t\tnew Grad4(-0.37968289875261624,  -0.753341017856078,    -0.37968289875261624,  -0.37968289875261624),\n\t\t\tnew Grad4(-0.4321472685365301,   -0.7821684431180708,   -0.4321472685365301,    0.12128480194602098),\n\t\t\tnew Grad4(-0.4321472685365301,   -0.7821684431180708,    0.12128480194602098,  -0.4321472685365301),\n\t\t\tnew Grad4( 0.12128480194602098,  -0.7821684431180708,   -0.4321472685365301,   -0.4321472685365301),\n\t\t\tnew Grad4(-0.508629699630796,    -0.8586508742123365,    0.044802370851755174,  0.044802370851755174),\n\t\t\tnew Grad4( 0.044802370851755174, -0.8586508742123365,   -0.508629699630796,     0.044802370851755174),\n\t\t\tnew Grad4( 0.044802370851755174, -0.8586508742123365,    0.044802370851755174, -0.508629699630796),\n\t\t\tnew Grad4(-0.03381941603233842,  -0.9982828964265062,   -0.03381941603233842,  -0.03381941603233842),\n\t\t\tnew Grad4(-0.37968289875261624,  -0.37968289875261624,  -0.753341017856078,    -0.37968289875261624),\n\t\t\tnew Grad4(-0.4321472685365301,   -0.4321472685365301,   -0.7821684431180708,    0.12128480194602098),\n\t\t\tnew Grad4(-0.4321472685365301,    0.12128480194602098,  -0.7821684431180708,   -0.4321472685365301),\n\t\t\tnew Grad4( 0.12128480194602098,  -0.4321472685365301,   -0.7821684431180708,   -0.4321472685365301),\n\t\t\tnew Grad4(-0.508629699630796,     0.044802370851755174, -0.8586508742123365,    0.044802370851755174),\n\t\t\tnew Grad4( 0.044802370851755174, -0.508629699630796,    -0.8586508742123365,    0.044802370851755174),\n\t\t\tnew Grad4( 0.044802370851755174,  0.044802370851755174, -0.8586508742123365,   -0.508629699630796),\n\t\t\tnew Grad4(-0.03381941603233842,  -0.03381941603233842,  -0.9982828964265062,   -0.03381941603233842),\n\t\t\tnew Grad4(-0.37968289875261624,  -0.37968289875261624,  -0.37968289875261624,  -0.753341017856078),\n\t\t\tnew Grad4(-0.4321472685365301,   -0.4321472685365301,    0.12128480194602098,  -0.7821684431180708),\n\t\t\tnew Grad4(-0.4321472685365301,    0.12128480194602098,  -0.4321472685365301,   -0.7821684431180708),\n\t\t\tnew Grad4( 0.12128480194602098,  -0.4321472685365301,   -0.4321472685365301,   -0.7821684431180708),\n\t\t\tnew Grad4(-0.508629699630796,     0.044802370851755174,  0.044802370851755174, -0.8586508742123365),\n\t\t\tnew Grad4( 0.044802370851755174, -0.508629699630796,     0.044802370851755174, -0.8586508742123365),\n\t\t\tnew Grad4( 0.044802370851755174,  0.044802370851755174, -0.508629699630796,    -0.8586508742123365),\n\t\t\tnew Grad4(-0.03381941603233842,  -0.03381941603233842,  -0.03381941603233842,  -0.9982828964265062),\n\t\t\tnew Grad4(-0.6740059517812944,   -0.3239847771997537,   -0.3239847771997537,    0.5794684678643381),\n\t\t\tnew Grad4(-0.7504883828755602,   -0.4004672082940195,    0.15296486218853164,   0.5029860367700724),\n\t\t\tnew Grad4(-0.7504883828755602,    0.15296486218853164,  -0.4004672082940195,    0.5029860367700724),\n\t\t\tnew Grad4(-0.8828161875373585,    0.08164729285680945,   0.08164729285680945,   0.4553054119602712),\n\t\t\tnew Grad4(-0.4553054119602712,   -0.08164729285680945,  -0.08164729285680945,   0.8828161875373585),\n\t\t\tnew Grad4(-0.5029860367700724,   -0.15296486218853164,   0.4004672082940195,    0.7504883828755602),\n\t\t\tnew Grad4(-0.5029860367700724,    0.4004672082940195,   -0.15296486218853164,   0.7504883828755602),\n\t\t\tnew Grad4(-0.5794684678643381,    0.3239847771997537,    0.3239847771997537,    0.6740059517812944),\n\t\t\tnew Grad4(-0.3239847771997537,   -0.6740059517812944,   -0.3239847771997537,    0.5794684678643381),\n\t\t\tnew Grad4(-0.4004672082940195,   -0.7504883828755602,    0.15296486218853164,   0.5029860367700724),\n\t\t\tnew Grad4( 0.15296486218853164,  -0.7504883828755602,   -0.4004672082940195,    0.5029860367700724),\n\t\t\tnew Grad4( 0.08164729285680945,  -0.8828161875373585,    0.08164729285680945,   0.4553054119602712),\n\t\t\tnew Grad4(-0.08164729285680945,  -0.4553054119602712,   -0.08164729285680945,   0.8828161875373585),\n\t\t\tnew Grad4(-0.15296486218853164,  -0.5029860367700724,    0.4004672082940195,    0.7504883828755602),\n\t\t\tnew Grad4( 0.4004672082940195,   -0.5029860367700724,   -0.15296486218853164,   0.7504883828755602),\n\t\t\tnew Grad4( 0.3239847771997537,   -0.5794684678643381,    0.3239847771997537,    0.6740059517812944),\n\t\t\tnew Grad4(-0.3239847771997537,   -0.3239847771997537,   -0.6740059517812944,    0.5794684678643381),\n\t\t\tnew Grad4(-0.4004672082940195,    0.15296486218853164,  -0.7504883828755602,    0.5029860367700724),\n\t\t\tnew Grad4( 0.15296486218853164,  -0.4004672082940195,   -0.7504883828755602,    0.5029860367700724),\n\t\t\tnew Grad4( 0.08164729285680945,   0.08164729285680945,  -0.8828161875373585,    0.4553054119602712),\n\t\t\tnew Grad4(-0.08164729285680945,  -0.08164729285680945,  -0.4553054119602712,    0.8828161875373585),\n\t\t\tnew Grad4(-0.15296486218853164,   0.4004672082940195,   -0.5029860367700724,    0.7504883828755602),\n\t\t\tnew Grad4( 0.4004672082940195,   -0.15296486218853164,  -0.5029860367700724,    0.7504883828755602),\n\t\t\tnew Grad4( 0.3239847771997537,    0.3239847771997537,   -0.5794684678643381,    0.6740059517812944),\n\t\t\tnew Grad4(-0.6740059517812944,   -0.3239847771997537,    0.5794684678643381,   -0.3239847771997537),\n\t\t\tnew Grad4(-0.7504883828755602,   -0.4004672082940195,    0.5029860367700724,    0.15296486218853164),\n\t\t\tnew Grad4(-0.7504883828755602,    0.15296486218853164,   0.5029860367700724,   -0.4004672082940195),\n\t\t\tnew Grad4(-0.8828161875373585,    0.08164729285680945,   0.4553054119602712,    0.08164729285680945),\n\t\t\tnew Grad4(-0.4553054119602712,   -0.08164729285680945,   0.8828161875373585,   -0.08164729285680945),\n\t\t\tnew Grad4(-0.5029860367700724,   -0.15296486218853164,   0.7504883828755602,    0.4004672082940195),\n\t\t\tnew Grad4(-0.5029860367700724,    0.4004672082940195,    0.7504883828755602,   -0.15296486218853164),\n\t\t\tnew Grad4(-0.5794684678643381,    0.3239847771997537,    0.6740059517812944,    0.3239847771997537),\n\t\t\tnew Grad4(-0.3239847771997537,   -0.6740059517812944,    0.5794684678643381,   -0.3239847771997537),\n\t\t\tnew Grad4(-0.4004672082940195,   -0.7504883828755602,    0.5029860367700724,    0.15296486218853164),\n\t\t\tnew Grad4( 0.15296486218853164,  -0.7504883828755602,    0.5029860367700724,   -0.4004672082940195),\n\t\t\tnew Grad4( 0.08164729285680945,  -0.8828161875373585,    0.4553054119602712,    0.08164729285680945),\n\t\t\tnew Grad4(-0.08164729285680945,  -0.4553054119602712,    0.8828161875373585,   -0.08164729285680945),\n\t\t\tnew Grad4(-0.15296486218853164,  -0.5029860367700724,    0.7504883828755602,    0.4004672082940195),\n\t\t\tnew Grad4( 0.4004672082940195,   -0.5029860367700724,    0.7504883828755602,   -0.15296486218853164),\n\t\t\tnew Grad4( 0.3239847771997537,   -0.5794684678643381,    0.6740059517812944,    0.3239847771997537),\n\t\t\tnew Grad4(-0.3239847771997537,   -0.3239847771997537,    0.5794684678643381,   -0.6740059517812944),\n\t\t\tnew Grad4(-0.4004672082940195,    0.15296486218853164,   0.5029860367700724,   -0.7504883828755602),\n\t\t\tnew Grad4( 0.15296486218853164,  -0.4004672082940195,    0.5029860367700724,   -0.7504883828755602),\n\t\t\tnew Grad4( 0.08164729285680945,   0.08164729285680945,   0.4553054119602712,   -0.8828161875373585),\n\t\t\tnew Grad4(-0.08164729285680945,  -0.08164729285680945,   0.8828161875373585,   -0.4553054119602712),\n\t\t\tnew Grad4(-0.15296486218853164,   0.4004672082940195,    0.7504883828755602,   -0.5029860367700724),\n\t\t\tnew Grad4( 0.4004672082940195,   -0.15296486218853164,   0.7504883828755602,   -0.5029860367700724),\n\t\t\tnew Grad4( 0.3239847771997537,    0.3239847771997537,    0.6740059517812944,   -0.5794684678643381),\n\t\t\tnew Grad4(-0.6740059517812944,    0.5794684678643381,   -0.3239847771997537,   -0.3239847771997537),\n\t\t\tnew Grad4(-0.7504883828755602,    0.5029860367700724,   -0.4004672082940195,    0.15296486218853164),\n\t\t\tnew Grad4(-0.7504883828755602,    0.5029860367700724,    0.15296486218853164,  -0.4004672082940195),\n\t\t\tnew Grad4(-0.8828161875373585,    0.4553054119602712,    0.08164729285680945,   0.08164729285680945),\n\t\t\tnew Grad4(-0.4553054119602712,    0.8828161875373585,   -0.08164729285680945,  -0.08164729285680945),\n\t\t\tnew Grad4(-0.5029860367700724,    0.7504883828755602,   -0.15296486218853164,   0.4004672082940195),\n\t\t\tnew Grad4(-0.5029860367700724,    0.7504883828755602,    0.4004672082940195,   -0.15296486218853164),\n\t\t\tnew Grad4(-0.5794684678643381,    0.6740059517812944,    0.3239847771997537,    0.3239847771997537),\n\t\t\tnew Grad4(-0.3239847771997537,    0.5794684678643381,   -0.6740059517812944,   -0.3239847771997537),\n\t\t\tnew Grad4(-0.4004672082940195,    0.5029860367700724,   -0.7504883828755602,    0.15296486218853164),\n\t\t\tnew Grad4( 0.15296486218853164,   0.5029860367700724,   -0.7504883828755602,   -0.4004672082940195),\n\t\t\tnew Grad4( 0.08164729285680945,   0.4553054119602712,   -0.8828161875373585,    0.08164729285680945),\n\t\t\tnew Grad4(-0.08164729285680945,   0.8828161875373585,   -0.4553054119602712,   -0.08164729285680945),\n\t\t\tnew Grad4(-0.15296486218853164,   0.7504883828755602,   -0.5029860367700724,    0.4004672082940195),\n\t\t\tnew Grad4( 0.4004672082940195,    0.7504883828755602,   -0.5029860367700724,   -0.15296486218853164),\n\t\t\tnew Grad4( 0.3239847771997537,    0.6740059517812944,   -0.5794684678643381,    0.3239847771997537),\n\t\t\tnew Grad4(-0.3239847771997537,    0.5794684678643381,   -0.3239847771997537,   -0.6740059517812944),\n\t\t\tnew Grad4(-0.4004672082940195,    0.5029860367700724,    0.15296486218853164,  -0.7504883828755602),\n\t\t\tnew Grad4( 0.15296486218853164,   0.5029860367700724,   -0.4004672082940195,   -0.7504883828755602),\n\t\t\tnew Grad4( 0.08164729285680945,   0.4553054119602712,    0.08164729285680945,  -0.8828161875373585),\n\t\t\tnew Grad4(-0.08164729285680945,   0.8828161875373585,   -0.08164729285680945,  -0.4553054119602712),\n\t\t\tnew Grad4(-0.15296486218853164,   0.7504883828755602,    0.4004672082940195,   -0.5029860367700724),\n\t\t\tnew Grad4( 0.4004672082940195,    0.7504883828755602,   -0.15296486218853164,  -0.5029860367700724),\n\t\t\tnew Grad4( 0.3239847771997537,    0.6740059517812944,    0.3239847771997537,   -0.5794684678643381),\n\t\t\tnew Grad4( 0.5794684678643381,   -0.6740059517812944,   -0.3239847771997537,   -0.3239847771997537),\n\t\t\tnew Grad4( 0.5029860367700724,   -0.7504883828755602,   -0.4004672082940195,    0.15296486218853164),\n\t\t\tnew Grad4( 0.5029860367700724,   -0.7504883828755602,    0.15296486218853164,  -0.4004672082940195),\n\t\t\tnew Grad4( 0.4553054119602712,   -0.8828161875373585,    0.08164729285680945,   0.08164729285680945),\n\t\t\tnew Grad4( 0.8828161875373585,   -0.4553054119602712,   -0.08164729285680945,  -0.08164729285680945),\n\t\t\tnew Grad4( 0.7504883828755602,   -0.5029860367700724,   -0.15296486218853164,   0.4004672082940195),\n\t\t\tnew Grad4( 0.7504883828755602,   -0.5029860367700724,    0.4004672082940195,   -0.15296486218853164),\n\t\t\tnew Grad4( 0.6740059517812944,   -0.5794684678643381,    0.3239847771997537,    0.3239847771997537),\n\t\t\tnew Grad4( 0.5794684678643381,   -0.3239847771997537,   -0.6740059517812944,   -0.3239847771997537),\n\t\t\tnew Grad4( 0.5029860367700724,   -0.4004672082940195,   -0.7504883828755602,    0.15296486218853164),\n\t\t\tnew Grad4( 0.5029860367700724,    0.15296486218853164,  -0.7504883828755602,   -0.4004672082940195),\n\t\t\tnew Grad4( 0.4553054119602712,    0.08164729285680945,  -0.8828161875373585,    0.08164729285680945),\n\t\t\tnew Grad4( 0.8828161875373585,   -0.08164729285680945,  -0.4553054119602712,   -0.08164729285680945),\n\t\t\tnew Grad4( 0.7504883828755602,   -0.15296486218853164,  -0.5029860367700724,    0.4004672082940195),\n\t\t\tnew Grad4( 0.7504883828755602,    0.4004672082940195,   -0.5029860367700724,   -0.15296486218853164),\n\t\t\tnew Grad4( 0.6740059517812944,    0.3239847771997537,   -0.5794684678643381,    0.3239847771997537),\n\t\t\tnew Grad4( 0.5794684678643381,   -0.3239847771997537,   -0.3239847771997537,   -0.6740059517812944),\n\t\t\tnew Grad4( 0.5029860367700724,   -0.4004672082940195,    0.15296486218853164,  -0.7504883828755602),\n\t\t\tnew Grad4( 0.5029860367700724,    0.15296486218853164,  -0.4004672082940195,   -0.7504883828755602),\n\t\t\tnew Grad4( 0.4553054119602712,    0.08164729285680945,   0.08164729285680945,  -0.8828161875373585),\n\t\t\tnew Grad4( 0.8828161875373585,   -0.08164729285680945,  -0.08164729285680945,  -0.4553054119602712),\n\t\t\tnew Grad4( 0.7504883828755602,   -0.15296486218853164,   0.4004672082940195,   -0.5029860367700724),\n\t\t\tnew Grad4( 0.7504883828755602,    0.4004672082940195,   -0.15296486218853164,  -0.5029860367700724),\n\t\t\tnew Grad4( 0.6740059517812944,    0.3239847771997537,    0.3239847771997537,   -0.5794684678643381),\n\t\t\tnew Grad4( 0.03381941603233842,   0.03381941603233842,   0.03381941603233842,   0.9982828964265062),\n\t\t\tnew Grad4(-0.044802370851755174, -0.044802370851755174,  0.508629699630796,     0.8586508742123365),\n\t\t\tnew Grad4(-0.044802370851755174,  0.508629699630796,    -0.044802370851755174,  0.8586508742123365),\n\t\t\tnew Grad4(-0.12128480194602098,   0.4321472685365301,    0.4321472685365301,    0.7821684431180708),\n\t\t\tnew Grad4( 0.508629699630796,    -0.044802370851755174, -0.044802370851755174,  0.8586508742123365),\n\t\t\tnew Grad4( 0.4321472685365301,   -0.12128480194602098,   0.4321472685365301,    0.7821684431180708),\n\t\t\tnew Grad4( 0.4321472685365301,    0.4321472685365301,   -0.12128480194602098,   0.7821684431180708),\n\t\t\tnew Grad4( 0.37968289875261624,   0.37968289875261624,   0.37968289875261624,   0.753341017856078),\n\t\t\tnew Grad4( 0.03381941603233842,   0.03381941603233842,   0.9982828964265062,    0.03381941603233842),\n\t\t\tnew Grad4(-0.044802370851755174,  0.044802370851755174,  0.8586508742123365,    0.508629699630796),\n\t\t\tnew Grad4(-0.044802370851755174,  0.508629699630796,     0.8586508742123365,   -0.044802370851755174),\n\t\t\tnew Grad4(-0.12128480194602098,   0.4321472685365301,    0.7821684431180708,    0.4321472685365301),\n\t\t\tnew Grad4( 0.508629699630796,    -0.044802370851755174,  0.8586508742123365,   -0.044802370851755174),\n\t\t\tnew Grad4( 0.4321472685365301,   -0.12128480194602098,   0.7821684431180708,    0.4321472685365301),\n\t\t\tnew Grad4( 0.4321472685365301,    0.4321472685365301,    0.7821684431180708,   -0.12128480194602098),\n\t\t\tnew Grad4( 0.37968289875261624,   0.37968289875261624,   0.753341017856078,     0.37968289875261624),\n\t\t\tnew Grad4( 0.03381941603233842,   0.9982828964265062,    0.03381941603233842,   0.03381941603233842),\n\t\t\tnew Grad4(-0.044802370851755174,  0.8586508742123365,   -0.044802370851755174,  0.508629699630796),\n\t\t\tnew Grad4(-0.044802370851755174,  0.8586508742123365,    0.508629699630796,    -0.044802370851755174),\n\t\t\tnew Grad4(-0.12128480194602098,   0.7821684431180708,    0.4321472685365301,    0.4321472685365301),\n\t\t\tnew Grad4( 0.508629699630796,     0.8586508742123365,   -0.044802370851755174, -0.044802370851755174),\n\t\t\tnew Grad4( 0.4321472685365301,    0.7821684431180708,   -0.12128480194602098,   0.4321472685365301),\n\t\t\tnew Grad4( 0.4321472685365301,    0.7821684431180708,    0.4321472685365301,   -0.12128480194602098),\n\t\t\tnew Grad4( 0.37968289875261624,   0.753341017856078,     0.37968289875261624,   0.37968289875261624),\n\t\t\tnew Grad4( 0.9982828964265062,    0.03381941603233842,   0.03381941603233842,   0.03381941603233842),\n\t\t\tnew Grad4( 0.8586508742123365,   -0.044802370851755174, -0.044802370851755174,  0.508629699630796),\n\t\t\tnew Grad4( 0.8586508742123365,   -0.044802370851755174,  0.508629699630796,    -0.044802370851755174),\n\t\t\tnew Grad4( 0.7821684431180708,   -0.12128480194602098,   0.4321472685365301,    0.4321472685365301),\n\t\t\tnew Grad4( 0.8586508742123365,    0.508629699630796,    -0.044802370851755174, -0.044802370851755174),\n\t\t\tnew Grad4( 0.7821684431180708,    0.4321472685365301,   -0.12128480194602098,   0.4321472685365301),\n\t\t\tnew Grad4( 0.7821684431180708,    0.4321472685365301,    0.4321472685365301,   -0.12128480194602098),\n\t\t\tnew Grad4( 0.753341017856078,     0.37968289875261624,   0.37968289875261624,   0.37968289875261624)\n\t\t};\n\t\tfor (int i = 0; i < grad4.length; i++) {\n\t\t\tgrad4[i].dx /= N4; grad4[i].dy /= N4; grad4[i].dz /= N4; grad4[i].dw /= N4;\n\t\t}\n\t\tfor (int i = 0; i < PSIZE; i++) {\n\t\t\tGRADIENTS_4D[i] = grad4[i % grad4.length];\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "_old/java/legacy/OpenSimplex.java",
    "content": "/**\n * K.jpg's original OpenSimplex Noise\n * DigitalShadow's optimized implementation, https://gist.github.com/digitalshadow/134a3a02b67cecd72181/\n * with updated gradient sets (Dec 2019, Feb 2020)\n *\n * If 4D noise is not needed, is recommended to use OpenSimplex2 instead.\n * Choose OpenSimplex2S for comparable smoothness, or choose OpenSimplex2F for speed.\n * If 4D noise is needed, 4D OpenSimplex2 will come, but this can suffice.\n *\n * XYBeforeZ and XZBeforeY functions for 3D have been added, though they aren't as nice as in OpenSimplex2\n */\n\npublic class OpenSimplex\n{\n\tprivate static final double STRETCH_2D = -0.211324865405187;    // (1/Math.sqrt(2+1)-1)/2;\n\tprivate static final double STRETCH_3D = -1.0 / 6.0;            // (1/Math.sqrt(3+1)-1)/3;\n\tprivate static final double STRETCH_4D = -0.138196601125011;    // (1/Math.sqrt(4+1)-1)/4;\n\tprivate static final double SQUISH_2D = 0.366025403784439;      // (Math.sqrt(2+1)-1)/2;\n\tprivate static final double SQUISH_3D = 1.0 / 3.0;              // (Math.sqrt(3+1)-1)/3;\n\tprivate static final double SQUISH_4D = 0.309016994374947;      // (Math.sqrt(4+1)-1)/4;\n\tprivate static final int PSIZE = 2048;\n\tprivate static final int PMASK = 2047;\n\n\tprivate short[] perm;\n\tprivate Grad2[] permGrad2;\n\tprivate Grad3[] permGrad3;\n\tprivate Grad4[] permGrad4;\n\n\tpublic OpenSimplex(long seed) {\n\t\tperm = new short[PSIZE];\n\t\tpermGrad2 = new Grad2[PSIZE];\n\t\tpermGrad3 = new Grad3[PSIZE];\n\t\tpermGrad4 = new Grad4[PSIZE];\n\t\tshort[] source = new short[PSIZE];\n\t\tfor (int i = 0; i < PSIZE; i++) {\n\t\t\tsource[i] = (short)i;\n\t\t}\n\t\tfor (int i = PSIZE - 1 ; i >= 0; i--) {\n\t\t\tseed = seed * 6364136223846793005L + 1442695040888963407L;\n\t\t\tint r = (int)((seed + 31) % (i + 1));\n\t\t\tif (r < 0) {\n\t\t\t\tr += (i + 1);\n\t\t\t}\n\t\t\tperm[i] = source[r];\n\t\t\tpermGrad2[i] = GRADIENTS_2D[perm[i]];\n\t\t\tpermGrad3[i] = GRADIENTS_3D[perm[i]];\n\t\t\tpermGrad4[i] = GRADIENTS_4D[perm[i]];\n\t\t\tsource[r] = source[i];\n\t\t}\n\t}\n\n\tpublic double eval(double x, double y) {\n\t\tdouble stretchOffset = (x + y) * STRETCH_2D;\n\t\tdouble xs = x + stretchOffset;\n\t\tdouble ys = y + stretchOffset;\n\n\t\tint xsb = fastFloor(xs);\n\t\tint ysb = fastFloor(ys);\n\n\t\tdouble xins = xs - xsb;\n\t\tdouble yins = ys - ysb;\n\n\t\tdouble inSum = xins + yins;\n\n\t\tdouble squishOffsetIns = inSum * SQUISH_2D;\n\t\tdouble dx0 = xins + squishOffsetIns;\n\t\tdouble dy0 = yins + squishOffsetIns;\n\n\t\tint hash =\n\t\t   (int)(xins - yins + 1) |\n\t\t   (int)(inSum) << 1 |\n\t\t   (int)(inSum + yins) << 2 |\n\t\t   (int)(inSum + xins) << 4;\n\n\t\tContribution2 c = LOOKUP_2D[hash];\n\n\t\tdouble value = 0.0;\n\t\twhile (c != null) {\n\t\t\tdouble dx = dx0 + c.dx;\n\t\t\tdouble dy = dy0 + c.dy;\n\t\t\tdouble attn = 2 - dx * dx - dy * dy;\n\t\t\tif (attn > 0) {\n\t\t\t\tint px = xsb + c.xsb;\n\t\t\t\tint py = ysb + c.ysb;\n\n\t\t\t\tGrad2 grad = permGrad2[perm[px & PMASK] ^ (py & PMASK)];\n\t\t\t\tdouble valuePart = grad.dx * dx + grad.dy * dy;\n\n\t\t\t\tattn *= attn;\n\t\t\t\tvalue += attn * attn * valuePart;\n\t\t\t}\n\t\t\tc = c.next;\n\t\t}\n\t\treturn value;\n\t}\n\t\n\tpublic double eval(double x, double y, double z) {\n\t\tdouble stretchOffset = (x + y + z) * STRETCH_3D;\n\t\tdouble xs = x + stretchOffset;\n\t\tdouble ys = y + stretchOffset;\n\t\tdouble zs = z + stretchOffset;\n\t\t\n\t\treturn eval3_Base(xs, ys, zs);\n\t}\n\n\t// Not as good as in SuperSimplex/OpenSimplex2S, since there are more visible differences between different slices.\n\t// The Z coordinate should always be the \"different\" coordinate in your use case.\n\tpublic double eval3_XYBeforeZ(double x, double y, double z)\n\t{\n\t\t// Combine rotation with skew transform.\n\t\tdouble xy = x + y;\n\t\tdouble s2 = xy * 0.211324865405187;\n\t\tdouble zz = z * 0.288675134594813;\n\t\tdouble xs = s2 - x + zz, ys = s2 - y + zz;\n\t\tdouble zs = xy * 0.577350269189626 + zz;\n\n\t\treturn eval3_Base(xs, ys, zs);\n\t}\n\n\t// Similar to the above, except the Y coordinate should always be the \"different\" coordinate in your use case.\n\tpublic double eval3_XZBeforeY(double x, double y, double z)\n\t{\n\t\t// Combine rotation with skew transform.\n\t\tdouble xz = x + z;\n\t\tdouble s2 = xz * 0.211324865405187;\n\t\tdouble yy = y * 0.288675134594813;\n\t\tdouble xs = s2 - x + yy, zs = s2 - z + yy;\n\t\tdouble ys = xz * 0.577350269189626 + yy;\n\n\t\treturn eval3_Base(xs, ys, zs);\n\t}\n\t\n\tprivate double eval3_Base(double xs, double ys, double zs) {\n\t\tint xsb = fastFloor(xs);\n\t\tint ysb = fastFloor(ys);\n\t\tint zsb = fastFloor(zs);\n\n\t\tdouble xins = xs - xsb;\n\t\tdouble yins = ys - ysb;\n\t\tdouble zins = zs - zsb;\n\n\t\tdouble inSum = xins + yins + zins;\n\n\t\tdouble squishOffsetIns = inSum * SQUISH_3D;\n\t\tdouble dx0 = xins + squishOffsetIns;\n\t\tdouble dy0 = yins + squishOffsetIns;\n\t\tdouble dz0 = zins + squishOffsetIns;\n\n\t\tint hash =\n\t\t   (int)(yins - zins + 1) |\n\t\t   (int)(xins - yins + 1) << 1 |\n\t\t   (int)(xins - zins + 1) << 2 |\n\t\t   (int)inSum << 3 |\n\t\t   (int)(inSum + zins) << 5 |\n\t\t   (int)(inSum + yins) << 7 |\n\t\t   (int)(inSum + xins) << 9;\n\n\t\tContribution3 c = LOOKUP_3D[hash];\n\n\t\tdouble value = 0.0;\n\t\twhile (c != null) {\n\t\t\tdouble dx = dx0 + c.dx;\n\t\t\tdouble dy = dy0 + c.dy;\n\t\t\tdouble dz = dz0 + c.dz;\n\t\t\tdouble attn = 2 - dx * dx - dy * dy - dz * dz;\n\t\t\tif (attn > 0) {\n\t\t\t\tint px = xsb + c.xsb;\n\t\t\t\tint py = ysb + c.ysb;\n\t\t\t\tint pz = zsb + c.zsb;\n\n\t\t\t\tGrad3 grad = permGrad3[perm[perm[px & PMASK] ^ (py & PMASK)] ^ (pz & PMASK)];\n\t\t\t\tdouble valuePart = grad.dx * dx + grad.dy * dy + grad.dz * dz;\n\n\t\t\t\tattn *= attn;\n\t\t\t\tvalue += attn * attn * valuePart;\n\t\t\t}\n\n\t\t\tc = c.next;\n\t\t}\n\t\treturn value;\n\t}\n\t\n\tpublic double eval(double x, double y, double z, double w) {\n\t\t\n\t\t// Get points for A4 lattice\n\t\tdouble s = -0.138196601125011 * (x + y + z + w);\n\t\tdouble xs = x + s, ys = y + s, zs = z + s, ws = w + s;\n\t\t\n\t\treturn eval4_Base(xs, ys, zs, ws);\n\t}\n\t\n\tpublic double eval4_XYBeforeZW(double x, double y, double z, double w) {\n\t\t\n\t\tdouble s2 = (x + y) * -0.178275657951399372 + (z + w) * 0.215623393288842828;\n\t\tdouble t2 = (z + w) * -0.403949762580207112 + (x + y) * -0.375199083010075342;\n\t\tdouble xs = x + s2, ys = y + s2, zs = z + t2, ws = w + t2;\n\t\t\n\t\treturn eval4_Base(xs, ys, zs, ws);\n\t}\n\t\n\tpublic double eval4_XZBeforeYW(double x, double y, double z, double w) {\n\t\t\n\t\tdouble s2 = (x + z) * -0.178275657951399372 + (y + w) * 0.215623393288842828;\n\t\tdouble t2 = (y + w) * -0.403949762580207112 + (x + z) * -0.375199083010075342;\n\t\tdouble xs = x + s2, ys = y + t2, zs = z + s2, ws = w + t2;\n\t\t\n\t\treturn eval4_Base(xs, ys, zs, ws);\n\t}\n\t\n\tpublic double eval4_XYZBeforeW(double x, double y, double z, double w) {\n\t\t\n\t\tdouble xyz = x + y + z;\n\t\tdouble ww = w * 0.2236067977499788;\n\t\tdouble s2 = xyz * -0.16666666666666666 + ww;\n\t\tdouble xs = x + s2, ys = y + s2, zs = z + s2, ws = -0.5 * xyz + ww;\n\t\t\n\t\treturn eval4_Base(xs, ys, zs, ws);\n\t}\n\n\tprivate double eval4_Base(double xs, double ys, double zs, double ws) {\n\t\tint xsb = fastFloor(xs);\n\t\tint ysb = fastFloor(ys);\n\t\tint zsb = fastFloor(zs);\n\t\tint wsb = fastFloor(ws);\n\n\t\tdouble xins = xs - xsb;\n\t\tdouble yins = ys - ysb;\n\t\tdouble zins = zs - zsb;\n\t\tdouble wins = ws - wsb;\n\n\t\tdouble inSum = xins + yins + zins + wins;\n\n\t\tdouble squishOffsetIns = inSum * SQUISH_4D;\n\t\tdouble dx0 = xins + squishOffsetIns;\n\t\tdouble dy0 = yins + squishOffsetIns;\n\t\tdouble dz0 = zins + squishOffsetIns;\n\t\tdouble dw0 = wins + squishOffsetIns;\n\n\t\tint hash =\n\t\t\t(int)(zins - wins + 1) |\n\t\t\t(int)(yins - zins + 1) << 1 |\n\t\t\t(int)(yins - wins + 1) << 2 |\n\t\t\t(int)(xins - yins + 1) << 3 |\n\t\t\t(int)(xins - zins + 1) << 4 |\n\t\t\t(int)(xins - wins + 1) << 5 |\n\t\t\t(int)inSum << 6 |\n\t\t\t(int)(inSum + wins) << 8 |\n\t\t\t(int)(inSum + zins) << 11 |\n\t\t\t(int)(inSum + yins) << 14 |\n\t\t\t(int)(inSum + xins) << 17;\n\n\t\tContribution4 c = LOOKUP_4D[hash];\n\n\t\tdouble value = 0.0;\n\t\twhile (c != null) {\n\t\t\tdouble dx = dx0 + c.dx;\n\t\t\tdouble dy = dy0 + c.dy;\n\t\t\tdouble dz = dz0 + c.dz;\n\t\t\tdouble dw = dw0 + c.dw;\n\t\t\tdouble attn = 2 - dx * dx - dy * dy - dz * dz - dw * dw;\n\t\t\tif (attn > 0) {\n\t\t\t\tint px = xsb + c.xsb;\n\t\t\t\tint py = ysb + c.ysb;\n\t\t\t\tint pz = zsb + c.zsb;\n\t\t\t\tint pw = wsb + c.wsb;\n\n\t\t\t\tGrad4 grad = permGrad4[perm[perm[perm[px & PMASK] ^ (py & PMASK)] ^ (pz & PMASK)] ^ (pw & PMASK)];\n\t\t\t\tdouble valuePart = grad.dx * dx + grad.dy * dy + grad.dz * dz + grad.dw * dw;\n\n\t\t\t\tattn *= attn;\n\t\t\t\tvalue += attn * attn * valuePart;\n\t\t\t}\n\n\t\t\tc = c.next;\n\t\t}\n\t\treturn value;\n\t}\n\n\tprivate static class Contribution2 {\n\t\tdouble dx, dy;\n\t\tint xsb, ysb;\n\t\tContribution2 next;\n\n\t\tpublic Contribution2(double multiplier, int xsb, int ysb) {\n\t\t\tdx = -xsb - multiplier * SQUISH_2D;\n\t\t\tdy = -ysb - multiplier * SQUISH_2D;\n\t\t\tthis.xsb = xsb;\n\t\t\tthis.ysb = ysb;\n\t\t}\n\t}\n\n\tprivate static class Contribution3 {\n\t\tdouble dx, dy, dz;\n\t\tint xsb, ysb, zsb;\n\t\tContribution3 next;\n\n\t\tpublic Contribution3(double multiplier, int xsb, int ysb, int zsb) {\n\t\t\tdx = -xsb - multiplier * SQUISH_3D;\n\t\t\tdy = -ysb - multiplier * SQUISH_3D;\n\t\t\tdz = -zsb - multiplier * SQUISH_3D;\n\t\t\tthis.xsb = xsb;\n\t\t\tthis.ysb = ysb;\n\t\t\tthis.zsb = zsb;\n\t\t}\n\t}\n\n\tprivate static class Contribution4 {\n\t\tdouble dx, dy, dz, dw;\n\t\tint xsb, ysb, zsb, wsb;\n\t\tContribution4 next;\n\n\t\tpublic Contribution4(double multiplier, int xsb, int ysb, int zsb, int wsb) {\n\t\t\tdx = -xsb - multiplier * SQUISH_4D;\n\t\t\tdy = -ysb - multiplier * SQUISH_4D;\n\t\t\tdz = -zsb - multiplier * SQUISH_4D;\n\t\t\tdw = -wsb - multiplier * SQUISH_4D;\n\t\t\tthis.xsb = xsb;\n\t\t\tthis.ysb = ysb;\n\t\t\tthis.zsb = zsb;\n\t\t\tthis.wsb = wsb;\n\t\t}\n\t}\n\n\tpublic static class Grad2 {\n\t\tdouble dx, dy;\n\t\tpublic Grad2(double dx, double dy) {\n\t\t\tthis.dx = dx;\n\t\t\tthis.dy = dy;\n\t\t}\n\t}\n\n\tpublic static class Grad3 {\n\t\tdouble dx, dy, dz;\n\t\tpublic Grad3(double dx, double dy, double dz) {\n\t\t\tthis.dx = dx;\n\t\t\tthis.dy = dy;\n\t\t\tthis.dz = dz;\n\t\t}\n\t}\n\n\tpublic static class Grad4 {\n\t\tdouble dx, dy, dz, dw;\n\t\tpublic Grad4(double dx, double dy, double dz, double dw) {\n\t\t\tthis.dx = dx;\n\t\t\tthis.dy = dy;\n\t\t\tthis.dz = dz;\n\t\t\tthis.dw = dw;\n\t\t}\n\t}\n\t\n\t/*\n\t * Utility\n\t */\n\n\tprivate static int fastFloor(double x) {\n\t\tint xi = (int)x;\n\t\treturn x < xi ? xi - 1 : xi;\n\t}\n\t\n\t/*\n\t * Gradients and lookup tables\n\t */\n\n\tprivate static final Grad2[] GRADIENTS_2D;\n\tprivate static final Grad3[] GRADIENTS_3D;\n\tprivate static final Grad4[] GRADIENTS_4D;\n\n\tprivate static Contribution2[] LOOKUP_2D;\n\tprivate static Contribution3[] LOOKUP_3D;\n\tprivate static Contribution4[] LOOKUP_4D;\n\t\n\tprivate static final double N2 = 7.69084574549313;\n\tprivate static final double N3 = 26.92263139946168;\n\tprivate static final double N4 = 8.881759591352166;\n\n\tstatic {\n\t\tGRADIENTS_2D = new Grad2[PSIZE];\n\t\tGrad2[] grad2 = {\n\t\t\tnew Grad2( 0.130526192220052,  0.99144486137381),\n\t\t\tnew Grad2( 0.38268343236509,   0.923879532511287),\n\t\t\tnew Grad2( 0.608761429008721,  0.793353340291235),\n\t\t\tnew Grad2( 0.793353340291235,  0.608761429008721),\n\t\t\tnew Grad2( 0.923879532511287,  0.38268343236509),\n\t\t\tnew Grad2( 0.99144486137381,   0.130526192220051),\n\t\t\tnew Grad2( 0.99144486137381,  -0.130526192220051),\n\t\t\tnew Grad2( 0.923879532511287, -0.38268343236509),\n\t\t\tnew Grad2( 0.793353340291235, -0.60876142900872),\n\t\t\tnew Grad2( 0.608761429008721, -0.793353340291235),\n\t\t\tnew Grad2( 0.38268343236509,  -0.923879532511287),\n\t\t\tnew Grad2( 0.130526192220052, -0.99144486137381),\n\t\t\tnew Grad2(-0.130526192220052, -0.99144486137381),\n\t\t\tnew Grad2(-0.38268343236509,  -0.923879532511287),\n\t\t\tnew Grad2(-0.608761429008721, -0.793353340291235),\n\t\t\tnew Grad2(-0.793353340291235, -0.608761429008721),\n\t\t\tnew Grad2(-0.923879532511287, -0.38268343236509),\n\t\t\tnew Grad2(-0.99144486137381,  -0.130526192220052),\n\t\t\tnew Grad2(-0.99144486137381,   0.130526192220051),\n\t\t\tnew Grad2(-0.923879532511287,  0.38268343236509),\n\t\t\tnew Grad2(-0.793353340291235,  0.608761429008721),\n\t\t\tnew Grad2(-0.608761429008721,  0.793353340291235),\n\t\t\tnew Grad2(-0.38268343236509,   0.923879532511287),\n\t\t\tnew Grad2(-0.130526192220052,  0.99144486137381)\n\t\t};\n\t\tfor (int i = 0; i < grad2.length; i++) {\n\t\t\tgrad2[i].dx /= N2; grad2[i].dy /= N2;\n\t\t}\n\t\tfor (int i = 0; i < PSIZE; i++) {\n\t\t\tGRADIENTS_2D[i] = grad2[i % grad2.length];\n\t\t}\n\n\t\tGRADIENTS_3D = new Grad3[PSIZE];\n\t\tGrad3[] grad3 = {\n\t\t\tnew Grad3(-1.4082482904633333,    -1.4082482904633333,    -2.6329931618533333),\n\t\t\tnew Grad3(-0.07491495712999985,   -0.07491495712999985,   -3.29965982852),\n\t\t\tnew Grad3( 0.24732126143473554,   -1.6667938651159684,    -2.838945207362466),\n\t\t\tnew Grad3(-1.6667938651159684,     0.24732126143473554,   -2.838945207362466),\n\t\t\tnew Grad3(-1.4082482904633333,    -2.6329931618533333,    -1.4082482904633333),\n\t\t\tnew Grad3(-0.07491495712999985,   -3.29965982852,         -0.07491495712999985),\n\t\t\tnew Grad3(-1.6667938651159684,    -2.838945207362466,      0.24732126143473554),\n\t\t\tnew Grad3( 0.24732126143473554,   -2.838945207362466,     -1.6667938651159684),\n\t\t\tnew Grad3( 1.5580782047233335,     0.33333333333333337,   -2.8914115380566665),\n\t\t\tnew Grad3( 2.8914115380566665,    -0.33333333333333337,   -1.5580782047233335),\n\t\t\tnew Grad3( 1.8101897177633992,    -1.2760767510338025,    -2.4482280932803),\n\t\t\tnew Grad3( 2.4482280932803,        1.2760767510338025,    -1.8101897177633992),\n\t\t\tnew Grad3( 1.5580782047233335,    -2.8914115380566665,     0.33333333333333337),\n\t\t\tnew Grad3( 2.8914115380566665,    -1.5580782047233335,    -0.33333333333333337),\n\t\t\tnew Grad3( 2.4482280932803,       -1.8101897177633992,     1.2760767510338025),\n\t\t\tnew Grad3( 1.8101897177633992,    -2.4482280932803,       -1.2760767510338025),\n\t\t\tnew Grad3(-2.6329931618533333,    -1.4082482904633333,    -1.4082482904633333),\n\t\t\tnew Grad3(-3.29965982852,         -0.07491495712999985,   -0.07491495712999985),\n\t\t\tnew Grad3(-2.838945207362466,      0.24732126143473554,   -1.6667938651159684),\n\t\t\tnew Grad3(-2.838945207362466,     -1.6667938651159684,     0.24732126143473554),\n\t\t\tnew Grad3( 0.33333333333333337,    1.5580782047233335,    -2.8914115380566665),\n\t\t\tnew Grad3(-0.33333333333333337,    2.8914115380566665,    -1.5580782047233335),\n\t\t\tnew Grad3( 1.2760767510338025,     2.4482280932803,       -1.8101897177633992),\n\t\t\tnew Grad3(-1.2760767510338025,     1.8101897177633992,    -2.4482280932803),\n\t\t\tnew Grad3( 0.33333333333333337,   -2.8914115380566665,     1.5580782047233335),\n\t\t\tnew Grad3(-0.33333333333333337,   -1.5580782047233335,     2.8914115380566665),\n\t\t\tnew Grad3(-1.2760767510338025,    -2.4482280932803,        1.8101897177633992),\n\t\t\tnew Grad3( 1.2760767510338025,    -1.8101897177633992,     2.4482280932803),\n\t\t\tnew Grad3( 3.29965982852,          0.07491495712999985,    0.07491495712999985),\n\t\t\tnew Grad3( 2.6329931618533333,     1.4082482904633333,     1.4082482904633333),\n\t\t\tnew Grad3( 2.838945207362466,     -0.24732126143473554,    1.6667938651159684),\n\t\t\tnew Grad3( 2.838945207362466,      1.6667938651159684,    -0.24732126143473554),\n\t\t\tnew Grad3(-2.8914115380566665,     1.5580782047233335,     0.33333333333333337),\n\t\t\tnew Grad3(-1.5580782047233335,     2.8914115380566665,    -0.33333333333333337),\n\t\t\tnew Grad3(-2.4482280932803,        1.8101897177633992,    -1.2760767510338025),\n\t\t\tnew Grad3(-1.8101897177633992,     2.4482280932803,        1.2760767510338025),\n\t\t\tnew Grad3(-2.8914115380566665,     0.33333333333333337,    1.5580782047233335),\n\t\t\tnew Grad3(-1.5580782047233335,    -0.33333333333333337,    2.8914115380566665),\n\t\t\tnew Grad3(-1.8101897177633992,     1.2760767510338025,     2.4482280932803),\n\t\t\tnew Grad3(-2.4482280932803,       -1.2760767510338025,     1.8101897177633992),\n\t\t\tnew Grad3( 0.07491495712999985,    3.29965982852,          0.07491495712999985),\n\t\t\tnew Grad3( 1.4082482904633333,     2.6329931618533333,     1.4082482904633333),\n\t\t\tnew Grad3( 1.6667938651159684,     2.838945207362466,     -0.24732126143473554),\n\t\t\tnew Grad3(-0.24732126143473554,    2.838945207362466,      1.6667938651159684),\n\t\t\tnew Grad3( 0.07491495712999985,    0.07491495712999985,    3.29965982852),\n\t\t\tnew Grad3( 1.4082482904633333,     1.4082482904633333,     2.6329931618533333),\n\t\t\tnew Grad3(-0.24732126143473554,    1.6667938651159684,     2.838945207362466),\n\t\t\tnew Grad3( 1.6667938651159684,    -0.24732126143473554,    2.838945207362466)\n\t\t};\n\t\tfor (int i = 0; i < grad3.length; i++) {\n\t\t\tgrad3[i].dx /= N3; grad3[i].dy /= N3; grad3[i].dz /= N3;\n\t\t}\n\t\tfor (int i = 0; i < PSIZE; i++) {\n\t\t\tGRADIENTS_3D[i] = grad3[i % grad3.length];\n\t\t}\n\n\t\tGRADIENTS_4D = new Grad4[PSIZE];\n\t\tGrad4[] grad4 = {\n\t\t\tnew Grad4(-0.753341017856078,    -0.37968289875261624,  -0.37968289875261624,  -0.37968289875261624),\n\t\t\tnew Grad4(-0.7821684431180708,   -0.4321472685365301,   -0.4321472685365301,    0.12128480194602098),\n\t\t\tnew Grad4(-0.7821684431180708,   -0.4321472685365301,    0.12128480194602098,  -0.4321472685365301),\n\t\t\tnew Grad4(-0.7821684431180708,    0.12128480194602098,  -0.4321472685365301,   -0.4321472685365301),\n\t\t\tnew Grad4(-0.8586508742123365,   -0.508629699630796,     0.044802370851755174,  0.044802370851755174),\n\t\t\tnew Grad4(-0.8586508742123365,    0.044802370851755174, -0.508629699630796,     0.044802370851755174),\n\t\t\tnew Grad4(-0.8586508742123365,    0.044802370851755174,  0.044802370851755174, -0.508629699630796),\n\t\t\tnew Grad4(-0.9982828964265062,   -0.03381941603233842,  -0.03381941603233842,  -0.03381941603233842),\n\t\t\tnew Grad4(-0.37968289875261624,  -0.753341017856078,    -0.37968289875261624,  -0.37968289875261624),\n\t\t\tnew Grad4(-0.4321472685365301,   -0.7821684431180708,   -0.4321472685365301,    0.12128480194602098),\n\t\t\tnew Grad4(-0.4321472685365301,   -0.7821684431180708,    0.12128480194602098,  -0.4321472685365301),\n\t\t\tnew Grad4( 0.12128480194602098,  -0.7821684431180708,   -0.4321472685365301,   -0.4321472685365301),\n\t\t\tnew Grad4(-0.508629699630796,    -0.8586508742123365,    0.044802370851755174,  0.044802370851755174),\n\t\t\tnew Grad4( 0.044802370851755174, -0.8586508742123365,   -0.508629699630796,     0.044802370851755174),\n\t\t\tnew Grad4( 0.044802370851755174, -0.8586508742123365,    0.044802370851755174, -0.508629699630796),\n\t\t\tnew Grad4(-0.03381941603233842,  -0.9982828964265062,   -0.03381941603233842,  -0.03381941603233842),\n\t\t\tnew Grad4(-0.37968289875261624,  -0.37968289875261624,  -0.753341017856078,    -0.37968289875261624),\n\t\t\tnew Grad4(-0.4321472685365301,   -0.4321472685365301,   -0.7821684431180708,    0.12128480194602098),\n\t\t\tnew Grad4(-0.4321472685365301,    0.12128480194602098,  -0.7821684431180708,   -0.4321472685365301),\n\t\t\tnew Grad4( 0.12128480194602098,  -0.4321472685365301,   -0.7821684431180708,   -0.4321472685365301),\n\t\t\tnew Grad4(-0.508629699630796,     0.044802370851755174, -0.8586508742123365,    0.044802370851755174),\n\t\t\tnew Grad4( 0.044802370851755174, -0.508629699630796,    -0.8586508742123365,    0.044802370851755174),\n\t\t\tnew Grad4( 0.044802370851755174,  0.044802370851755174, -0.8586508742123365,   -0.508629699630796),\n\t\t\tnew Grad4(-0.03381941603233842,  -0.03381941603233842,  -0.9982828964265062,   -0.03381941603233842),\n\t\t\tnew Grad4(-0.37968289875261624,  -0.37968289875261624,  -0.37968289875261624,  -0.753341017856078),\n\t\t\tnew Grad4(-0.4321472685365301,   -0.4321472685365301,    0.12128480194602098,  -0.7821684431180708),\n\t\t\tnew Grad4(-0.4321472685365301,    0.12128480194602098,  -0.4321472685365301,   -0.7821684431180708),\n\t\t\tnew Grad4( 0.12128480194602098,  -0.4321472685365301,   -0.4321472685365301,   -0.7821684431180708),\n\t\t\tnew Grad4(-0.508629699630796,     0.044802370851755174,  0.044802370851755174, -0.8586508742123365),\n\t\t\tnew Grad4( 0.044802370851755174, -0.508629699630796,     0.044802370851755174, -0.8586508742123365),\n\t\t\tnew Grad4( 0.044802370851755174,  0.044802370851755174, -0.508629699630796,    -0.8586508742123365),\n\t\t\tnew Grad4(-0.03381941603233842,  -0.03381941603233842,  -0.03381941603233842,  -0.9982828964265062),\n\t\t\tnew Grad4(-0.6740059517812944,   -0.3239847771997537,   -0.3239847771997537,    0.5794684678643381),\n\t\t\tnew Grad4(-0.7504883828755602,   -0.4004672082940195,    0.15296486218853164,   0.5029860367700724),\n\t\t\tnew Grad4(-0.7504883828755602,    0.15296486218853164,  -0.4004672082940195,    0.5029860367700724),\n\t\t\tnew Grad4(-0.8828161875373585,    0.08164729285680945,   0.08164729285680945,   0.4553054119602712),\n\t\t\tnew Grad4(-0.4553054119602712,   -0.08164729285680945,  -0.08164729285680945,   0.8828161875373585),\n\t\t\tnew Grad4(-0.5029860367700724,   -0.15296486218853164,   0.4004672082940195,    0.7504883828755602),\n\t\t\tnew Grad4(-0.5029860367700724,    0.4004672082940195,   -0.15296486218853164,   0.7504883828755602),\n\t\t\tnew Grad4(-0.5794684678643381,    0.3239847771997537,    0.3239847771997537,    0.6740059517812944),\n\t\t\tnew Grad4(-0.3239847771997537,   -0.6740059517812944,   -0.3239847771997537,    0.5794684678643381),\n\t\t\tnew Grad4(-0.4004672082940195,   -0.7504883828755602,    0.15296486218853164,   0.5029860367700724),\n\t\t\tnew Grad4( 0.15296486218853164,  -0.7504883828755602,   -0.4004672082940195,    0.5029860367700724),\n\t\t\tnew Grad4( 0.08164729285680945,  -0.8828161875373585,    0.08164729285680945,   0.4553054119602712),\n\t\t\tnew Grad4(-0.08164729285680945,  -0.4553054119602712,   -0.08164729285680945,   0.8828161875373585),\n\t\t\tnew Grad4(-0.15296486218853164,  -0.5029860367700724,    0.4004672082940195,    0.7504883828755602),\n\t\t\tnew Grad4( 0.4004672082940195,   -0.5029860367700724,   -0.15296486218853164,   0.7504883828755602),\n\t\t\tnew Grad4( 0.3239847771997537,   -0.5794684678643381,    0.3239847771997537,    0.6740059517812944),\n\t\t\tnew Grad4(-0.3239847771997537,   -0.3239847771997537,   -0.6740059517812944,    0.5794684678643381),\n\t\t\tnew Grad4(-0.4004672082940195,    0.15296486218853164,  -0.7504883828755602,    0.5029860367700724),\n\t\t\tnew Grad4( 0.15296486218853164,  -0.4004672082940195,   -0.7504883828755602,    0.5029860367700724),\n\t\t\tnew Grad4( 0.08164729285680945,   0.08164729285680945,  -0.8828161875373585,    0.4553054119602712),\n\t\t\tnew Grad4(-0.08164729285680945,  -0.08164729285680945,  -0.4553054119602712,    0.8828161875373585),\n\t\t\tnew Grad4(-0.15296486218853164,   0.4004672082940195,   -0.5029860367700724,    0.7504883828755602),\n\t\t\tnew Grad4( 0.4004672082940195,   -0.15296486218853164,  -0.5029860367700724,    0.7504883828755602),\n\t\t\tnew Grad4( 0.3239847771997537,    0.3239847771997537,   -0.5794684678643381,    0.6740059517812944),\n\t\t\tnew Grad4(-0.6740059517812944,   -0.3239847771997537,    0.5794684678643381,   -0.3239847771997537),\n\t\t\tnew Grad4(-0.7504883828755602,   -0.4004672082940195,    0.5029860367700724,    0.15296486218853164),\n\t\t\tnew Grad4(-0.7504883828755602,    0.15296486218853164,   0.5029860367700724,   -0.4004672082940195),\n\t\t\tnew Grad4(-0.8828161875373585,    0.08164729285680945,   0.4553054119602712,    0.08164729285680945),\n\t\t\tnew Grad4(-0.4553054119602712,   -0.08164729285680945,   0.8828161875373585,   -0.08164729285680945),\n\t\t\tnew Grad4(-0.5029860367700724,   -0.15296486218853164,   0.7504883828755602,    0.4004672082940195),\n\t\t\tnew Grad4(-0.5029860367700724,    0.4004672082940195,    0.7504883828755602,   -0.15296486218853164),\n\t\t\tnew Grad4(-0.5794684678643381,    0.3239847771997537,    0.6740059517812944,    0.3239847771997537),\n\t\t\tnew Grad4(-0.3239847771997537,   -0.6740059517812944,    0.5794684678643381,   -0.3239847771997537),\n\t\t\tnew Grad4(-0.4004672082940195,   -0.7504883828755602,    0.5029860367700724,    0.15296486218853164),\n\t\t\tnew Grad4( 0.15296486218853164,  -0.7504883828755602,    0.5029860367700724,   -0.4004672082940195),\n\t\t\tnew Grad4( 0.08164729285680945,  -0.8828161875373585,    0.4553054119602712,    0.08164729285680945),\n\t\t\tnew Grad4(-0.08164729285680945,  -0.4553054119602712,    0.8828161875373585,   -0.08164729285680945),\n\t\t\tnew Grad4(-0.15296486218853164,  -0.5029860367700724,    0.7504883828755602,    0.4004672082940195),\n\t\t\tnew Grad4( 0.4004672082940195,   -0.5029860367700724,    0.7504883828755602,   -0.15296486218853164),\n\t\t\tnew Grad4( 0.3239847771997537,   -0.5794684678643381,    0.6740059517812944,    0.3239847771997537),\n\t\t\tnew Grad4(-0.3239847771997537,   -0.3239847771997537,    0.5794684678643381,   -0.6740059517812944),\n\t\t\tnew Grad4(-0.4004672082940195,    0.15296486218853164,   0.5029860367700724,   -0.7504883828755602),\n\t\t\tnew Grad4( 0.15296486218853164,  -0.4004672082940195,    0.5029860367700724,   -0.7504883828755602),\n\t\t\tnew Grad4( 0.08164729285680945,   0.08164729285680945,   0.4553054119602712,   -0.8828161875373585),\n\t\t\tnew Grad4(-0.08164729285680945,  -0.08164729285680945,   0.8828161875373585,   -0.4553054119602712),\n\t\t\tnew Grad4(-0.15296486218853164,   0.4004672082940195,    0.7504883828755602,   -0.5029860367700724),\n\t\t\tnew Grad4( 0.4004672082940195,   -0.15296486218853164,   0.7504883828755602,   -0.5029860367700724),\n\t\t\tnew Grad4( 0.3239847771997537,    0.3239847771997537,    0.6740059517812944,   -0.5794684678643381),\n\t\t\tnew Grad4(-0.6740059517812944,    0.5794684678643381,   -0.3239847771997537,   -0.3239847771997537),\n\t\t\tnew Grad4(-0.7504883828755602,    0.5029860367700724,   -0.4004672082940195,    0.15296486218853164),\n\t\t\tnew Grad4(-0.7504883828755602,    0.5029860367700724,    0.15296486218853164,  -0.4004672082940195),\n\t\t\tnew Grad4(-0.8828161875373585,    0.4553054119602712,    0.08164729285680945,   0.08164729285680945),\n\t\t\tnew Grad4(-0.4553054119602712,    0.8828161875373585,   -0.08164729285680945,  -0.08164729285680945),\n\t\t\tnew Grad4(-0.5029860367700724,    0.7504883828755602,   -0.15296486218853164,   0.4004672082940195),\n\t\t\tnew Grad4(-0.5029860367700724,    0.7504883828755602,    0.4004672082940195,   -0.15296486218853164),\n\t\t\tnew Grad4(-0.5794684678643381,    0.6740059517812944,    0.3239847771997537,    0.3239847771997537),\n\t\t\tnew Grad4(-0.3239847771997537,    0.5794684678643381,   -0.6740059517812944,   -0.3239847771997537),\n\t\t\tnew Grad4(-0.4004672082940195,    0.5029860367700724,   -0.7504883828755602,    0.15296486218853164),\n\t\t\tnew Grad4( 0.15296486218853164,   0.5029860367700724,   -0.7504883828755602,   -0.4004672082940195),\n\t\t\tnew Grad4( 0.08164729285680945,   0.4553054119602712,   -0.8828161875373585,    0.08164729285680945),\n\t\t\tnew Grad4(-0.08164729285680945,   0.8828161875373585,   -0.4553054119602712,   -0.08164729285680945),\n\t\t\tnew Grad4(-0.15296486218853164,   0.7504883828755602,   -0.5029860367700724,    0.4004672082940195),\n\t\t\tnew Grad4( 0.4004672082940195,    0.7504883828755602,   -0.5029860367700724,   -0.15296486218853164),\n\t\t\tnew Grad4( 0.3239847771997537,    0.6740059517812944,   -0.5794684678643381,    0.3239847771997537),\n\t\t\tnew Grad4(-0.3239847771997537,    0.5794684678643381,   -0.3239847771997537,   -0.6740059517812944),\n\t\t\tnew Grad4(-0.4004672082940195,    0.5029860367700724,    0.15296486218853164,  -0.7504883828755602),\n\t\t\tnew Grad4( 0.15296486218853164,   0.5029860367700724,   -0.4004672082940195,   -0.7504883828755602),\n\t\t\tnew Grad4( 0.08164729285680945,   0.4553054119602712,    0.08164729285680945,  -0.8828161875373585),\n\t\t\tnew Grad4(-0.08164729285680945,   0.8828161875373585,   -0.08164729285680945,  -0.4553054119602712),\n\t\t\tnew Grad4(-0.15296486218853164,   0.7504883828755602,    0.4004672082940195,   -0.5029860367700724),\n\t\t\tnew Grad4( 0.4004672082940195,    0.7504883828755602,   -0.15296486218853164,  -0.5029860367700724),\n\t\t\tnew Grad4( 0.3239847771997537,    0.6740059517812944,    0.3239847771997537,   -0.5794684678643381),\n\t\t\tnew Grad4( 0.5794684678643381,   -0.6740059517812944,   -0.3239847771997537,   -0.3239847771997537),\n\t\t\tnew Grad4( 0.5029860367700724,   -0.7504883828755602,   -0.4004672082940195,    0.15296486218853164),\n\t\t\tnew Grad4( 0.5029860367700724,   -0.7504883828755602,    0.15296486218853164,  -0.4004672082940195),\n\t\t\tnew Grad4( 0.4553054119602712,   -0.8828161875373585,    0.08164729285680945,   0.08164729285680945),\n\t\t\tnew Grad4( 0.8828161875373585,   -0.4553054119602712,   -0.08164729285680945,  -0.08164729285680945),\n\t\t\tnew Grad4( 0.7504883828755602,   -0.5029860367700724,   -0.15296486218853164,   0.4004672082940195),\n\t\t\tnew Grad4( 0.7504883828755602,   -0.5029860367700724,    0.4004672082940195,   -0.15296486218853164),\n\t\t\tnew Grad4( 0.6740059517812944,   -0.5794684678643381,    0.3239847771997537,    0.3239847771997537),\n\t\t\tnew Grad4( 0.5794684678643381,   -0.3239847771997537,   -0.6740059517812944,   -0.3239847771997537),\n\t\t\tnew Grad4( 0.5029860367700724,   -0.4004672082940195,   -0.7504883828755602,    0.15296486218853164),\n\t\t\tnew Grad4( 0.5029860367700724,    0.15296486218853164,  -0.7504883828755602,   -0.4004672082940195),\n\t\t\tnew Grad4( 0.4553054119602712,    0.08164729285680945,  -0.8828161875373585,    0.08164729285680945),\n\t\t\tnew Grad4( 0.8828161875373585,   -0.08164729285680945,  -0.4553054119602712,   -0.08164729285680945),\n\t\t\tnew Grad4( 0.7504883828755602,   -0.15296486218853164,  -0.5029860367700724,    0.4004672082940195),\n\t\t\tnew Grad4( 0.7504883828755602,    0.4004672082940195,   -0.5029860367700724,   -0.15296486218853164),\n\t\t\tnew Grad4( 0.6740059517812944,    0.3239847771997537,   -0.5794684678643381,    0.3239847771997537),\n\t\t\tnew Grad4( 0.5794684678643381,   -0.3239847771997537,   -0.3239847771997537,   -0.6740059517812944),\n\t\t\tnew Grad4( 0.5029860367700724,   -0.4004672082940195,    0.15296486218853164,  -0.7504883828755602),\n\t\t\tnew Grad4( 0.5029860367700724,    0.15296486218853164,  -0.4004672082940195,   -0.7504883828755602),\n\t\t\tnew Grad4( 0.4553054119602712,    0.08164729285680945,   0.08164729285680945,  -0.8828161875373585),\n\t\t\tnew Grad4( 0.8828161875373585,   -0.08164729285680945,  -0.08164729285680945,  -0.4553054119602712),\n\t\t\tnew Grad4( 0.7504883828755602,   -0.15296486218853164,   0.4004672082940195,   -0.5029860367700724),\n\t\t\tnew Grad4( 0.7504883828755602,    0.4004672082940195,   -0.15296486218853164,  -0.5029860367700724),\n\t\t\tnew Grad4( 0.6740059517812944,    0.3239847771997537,    0.3239847771997537,   -0.5794684678643381),\n\t\t\tnew Grad4( 0.03381941603233842,   0.03381941603233842,   0.03381941603233842,   0.9982828964265062),\n\t\t\tnew Grad4(-0.044802370851755174, -0.044802370851755174,  0.508629699630796,     0.8586508742123365),\n\t\t\tnew Grad4(-0.044802370851755174,  0.508629699630796,    -0.044802370851755174,  0.8586508742123365),\n\t\t\tnew Grad4(-0.12128480194602098,   0.4321472685365301,    0.4321472685365301,    0.7821684431180708),\n\t\t\tnew Grad4( 0.508629699630796,    -0.044802370851755174, -0.044802370851755174,  0.8586508742123365),\n\t\t\tnew Grad4( 0.4321472685365301,   -0.12128480194602098,   0.4321472685365301,    0.7821684431180708),\n\t\t\tnew Grad4( 0.4321472685365301,    0.4321472685365301,   -0.12128480194602098,   0.7821684431180708),\n\t\t\tnew Grad4( 0.37968289875261624,   0.37968289875261624,   0.37968289875261624,   0.753341017856078),\n\t\t\tnew Grad4( 0.03381941603233842,   0.03381941603233842,   0.9982828964265062,    0.03381941603233842),\n\t\t\tnew Grad4(-0.044802370851755174,  0.044802370851755174,  0.8586508742123365,    0.508629699630796),\n\t\t\tnew Grad4(-0.044802370851755174,  0.508629699630796,     0.8586508742123365,   -0.044802370851755174),\n\t\t\tnew Grad4(-0.12128480194602098,   0.4321472685365301,    0.7821684431180708,    0.4321472685365301),\n\t\t\tnew Grad4( 0.508629699630796,    -0.044802370851755174,  0.8586508742123365,   -0.044802370851755174),\n\t\t\tnew Grad4( 0.4321472685365301,   -0.12128480194602098,   0.7821684431180708,    0.4321472685365301),\n\t\t\tnew Grad4( 0.4321472685365301,    0.4321472685365301,    0.7821684431180708,   -0.12128480194602098),\n\t\t\tnew Grad4( 0.37968289875261624,   0.37968289875261624,   0.753341017856078,     0.37968289875261624),\n\t\t\tnew Grad4( 0.03381941603233842,   0.9982828964265062,    0.03381941603233842,   0.03381941603233842),\n\t\t\tnew Grad4(-0.044802370851755174,  0.8586508742123365,   -0.044802370851755174,  0.508629699630796),\n\t\t\tnew Grad4(-0.044802370851755174,  0.8586508742123365,    0.508629699630796,    -0.044802370851755174),\n\t\t\tnew Grad4(-0.12128480194602098,   0.7821684431180708,    0.4321472685365301,    0.4321472685365301),\n\t\t\tnew Grad4( 0.508629699630796,     0.8586508742123365,   -0.044802370851755174, -0.044802370851755174),\n\t\t\tnew Grad4( 0.4321472685365301,    0.7821684431180708,   -0.12128480194602098,   0.4321472685365301),\n\t\t\tnew Grad4( 0.4321472685365301,    0.7821684431180708,    0.4321472685365301,   -0.12128480194602098),\n\t\t\tnew Grad4( 0.37968289875261624,   0.753341017856078,     0.37968289875261624,   0.37968289875261624),\n\t\t\tnew Grad4( 0.9982828964265062,    0.03381941603233842,   0.03381941603233842,   0.03381941603233842),\n\t\t\tnew Grad4( 0.8586508742123365,   -0.044802370851755174, -0.044802370851755174,  0.508629699630796),\n\t\t\tnew Grad4( 0.8586508742123365,   -0.044802370851755174,  0.508629699630796,    -0.044802370851755174),\n\t\t\tnew Grad4( 0.7821684431180708,   -0.12128480194602098,   0.4321472685365301,    0.4321472685365301),\n\t\t\tnew Grad4( 0.8586508742123365,    0.508629699630796,    -0.044802370851755174, -0.044802370851755174),\n\t\t\tnew Grad4( 0.7821684431180708,    0.4321472685365301,   -0.12128480194602098,   0.4321472685365301),\n\t\t\tnew Grad4( 0.7821684431180708,    0.4321472685365301,    0.4321472685365301,   -0.12128480194602098),\n\t\t\tnew Grad4( 0.753341017856078,     0.37968289875261624,   0.37968289875261624,   0.37968289875261624)\n\t\t};\n\t\tfor (int i = 0; i < grad4.length; i++) {\n\t\t\tgrad4[i].dx /= N4; grad4[i].dy /= N4; grad4[i].dz /= N4; grad4[i].dw /= N4;\n\t\t}\n\t\tfor (int i = 0; i < PSIZE; i++) {\n\t\t\tGRADIENTS_4D[i] = grad4[i % grad4.length];\n\t\t}\n\n\t\tint[][] base2D = new int[][] {\n\t\t\tnew int[] { 1, 1, 0, 1, 0, 1, 0, 0, 0 },\n\t\t\tnew int[] { 1, 1, 0, 1, 0, 1, 2, 1, 1 }\n\t\t};\n\t\tint[] p2D = new int[] { 0, 0, 1, -1, 0, 0, -1, 1, 0, 2, 1, 1, 1, 2, 2, 0, 1, 2, 0, 2, 1, 0, 0, 0 };\n\t\tint[] lookupPairs2D = new int[] { 0, 1, 1, 0, 4, 1, 17, 0, 20, 2, 21, 2, 22, 5, 23, 5, 26, 4, 39, 3, 42, 4, 43, 3 };\n\n\t\tContribution2[] contributions2D = new Contribution2[p2D.length / 4];\n\t\tfor (int i = 0; i < p2D.length; i += 4) {\n\t\t\tint[] baseSet = base2D[p2D[i]];\n\t\t\tContribution2 previous = null, current = null;\n\t\t\tfor (int k = 0; k < baseSet.length; k += 3) {\n\t\t\t\tcurrent = new Contribution2(baseSet[k], baseSet[k + 1], baseSet[k + 2]);\n\t\t\t\tif (previous == null) {\n\t\t\t\t\tcontributions2D[i / 4] = current;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tprevious.next = current;\n\t\t\t\t}\n\t\t\t\tprevious = current;\n\t\t\t}\n\t\t\tcurrent.next = new Contribution2(p2D[i + 1], p2D[i + 2], p2D[i + 3]);\n\t\t}\n\n\t\tLOOKUP_2D = new Contribution2[64];\n\t\tfor (int i = 0; i < lookupPairs2D.length; i += 2) {\n\t\t\tLOOKUP_2D[lookupPairs2D[i]] = contributions2D[lookupPairs2D[i + 1]];\n\t\t}\n\t\t\n\t\tint[][] base3D = new int[][] {\n\t\t\tnew int[] { 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1 },\n\t\t\tnew int[] { 2, 1, 1, 0, 2, 1, 0, 1, 2, 0, 1, 1, 3, 1, 1, 1 },\n\t\t\tnew int[] { 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 2, 1, 1, 0, 2, 1, 0, 1, 2, 0, 1, 1 }\n\t\t};\n\t\tint[] p3D = new int[] { 0, 0, 1, -1, 0, 0, 1, 0, -1, 0, 0, -1, 1, 0, 0, 0, 1, -1, 0, 0, -1, 0, 1, 0, 0, -1, 1, 0, 2, 1, 1, 0, 1, 1, 1, -1, 0, 2, 1, 0, 1, 1, 1, -1, 1, 0, 2, 0, 1, 1, 1, -1, 1, 1, 1, 3, 2, 1, 0, 3, 1, 2, 0, 1, 3, 2, 0, 1, 3, 1, 0, 2, 1, 3, 0, 2, 1, 3, 0, 1, 2, 1, 1, 1, 0, 0, 2, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 2, 0, 1, 1, 0, 0, 1, 2, 0, 0, 2, 2, 0, 0, 0, 0, 1, 1, -1, 1, 2, 0, 0, 0, 0, 1, -1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, -1, 2, 3, 1, 1, 1, 2, 0, 0, 2, 2, 3, 1, 1, 1, 2, 2, 0, 0, 2, 3, 1, 1, 1, 2, 0, 2, 0, 2, 1, 1, -1, 1, 2, 0, 0, 2, 2, 1, 1, -1, 1, 2, 2, 0, 0, 2, 1, -1, 1, 1, 2, 0, 0, 2, 2, 1, -1, 1, 1, 2, 0, 2, 0, 2, 1, 1, 1, -1, 2, 2, 0, 0, 2, 1, 1, 1, -1, 2, 0, 2, 0 };\n\t\tint[] lookupPairs3D = new int[] { 0, 2, 1, 1, 2, 2, 5, 1, 6, 0, 7, 0, 32, 2, 34, 2, 129, 1, 133, 1, 160, 5, 161, 5, 518, 0, 519, 0, 546, 4, 550, 4, 645, 3, 647, 3, 672, 5, 673, 5, 674, 4, 677, 3, 678, 4, 679, 3, 680, 13, 681, 13, 682, 12, 685, 14, 686, 12, 687, 14, 712, 20, 714, 18, 809, 21, 813, 23, 840, 20, 841, 21, 1198, 19, 1199, 22, 1226, 18, 1230, 19, 1325, 23, 1327, 22, 1352, 15, 1353, 17, 1354, 15, 1357, 17, 1358, 16, 1359, 16, 1360, 11, 1361, 10, 1362, 11, 1365, 10, 1366, 9, 1367, 9, 1392, 11, 1394, 11, 1489, 10, 1493, 10, 1520, 8, 1521, 8, 1878, 9, 1879, 9, 1906, 7, 1910, 7, 2005, 6, 2007, 6, 2032, 8, 2033, 8, 2034, 7, 2037, 6, 2038, 7, 2039, 6 };\n\n\t\tContribution3[] contributions3D = new Contribution3[p3D.length / 9];\n\t\tfor (int i = 0; i < p3D.length; i += 9) {\n\t\t\tint[] baseSet = base3D[p3D[i]];\n\t\t\tContribution3 previous = null, current = null;\n\t\t\tfor (int k = 0; k < baseSet.length; k += 4) {\n\t\t\t\tcurrent = new Contribution3(baseSet[k], baseSet[k + 1], baseSet[k + 2], baseSet[k + 3]);\n\t\t\t\tif (previous == null) {\n\t\t\t\t\tcontributions3D[i / 9] = current;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tprevious.next = current;\n\t\t\t\t}\n\t\t\t\tprevious = current;\n\t\t\t}\n\t\t\tcurrent.next = new Contribution3(p3D[i + 1], p3D[i + 2], p3D[i + 3], p3D[i + 4]);\n\t\t\tcurrent.next.next = new Contribution3(p3D[i + 5], p3D[i + 6], p3D[i + 7], p3D[i + 8]);\n\t\t}\n\n\t\tLOOKUP_3D = new Contribution3[2048];\n\t\tfor (int i = 0; i < lookupPairs3D.length; i += 2) {\n\t\t\tLOOKUP_3D[lookupPairs3D[i]] = contributions3D[lookupPairs3D[i + 1]];\n\t\t}\n\n\t\tint[][] base4D = new int[][] {\n\t\t\tnew int[] { 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1 },\n\t\t\tnew int[] { 3, 1, 1, 1, 0, 3, 1, 1, 0, 1, 3, 1, 0, 1, 1, 3, 0, 1, 1, 1, 4, 1, 1, 1, 1 },\n\t\t\tnew int[] { 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 2, 1, 1, 0, 0, 2, 1, 0, 1, 0, 2, 1, 0, 0, 1, 2, 0, 1, 1, 0, 2, 0, 1, 0, 1, 2, 0, 0, 1, 1 },\n\t\t\tnew int[] { 3, 1, 1, 1, 0, 3, 1, 1, 0, 1, 3, 1, 0, 1, 1, 3, 0, 1, 1, 1, 2, 1, 1, 0, 0, 2, 1, 0, 1, 0, 2, 1, 0, 0, 1, 2, 0, 1, 1, 0, 2, 0, 1, 0, 1, 2, 0, 0, 1, 1 }\n\t\t};\n\t\tint[] p4D = new int[] { 0, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 1, 0, 0, 0, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 0, -1, 0, 1, 0, 0, 0, -1, 1, 0, 0, 0, 0, 1, -1, 0, 0, -1, 0, 0, 1, 0, 0, -1, 0, 1, 0, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0, 1, 1, 1, -1, 0, 1, 1, 1, 0, -1, 0, 2, 1, 0, 1, 0, 1, 1, -1, 1, 0, 1, 1, 0, 1, -1, 0, 2, 0, 1, 1, 0, 1, -1, 1, 1, 0, 1, 0, 1, 1, -1, 0, 2, 1, 0, 0, 1, 1, 1, -1, 0, 1, 1, 1, 0, -1, 1, 0, 2, 0, 1, 0, 1, 1, -1, 1, 0, 1, 1, 0, 1, -1, 1, 0, 2, 0, 0, 1, 1, 1, -1, 0, 1, 1, 1, 0, -1, 1, 1, 1, 4, 2, 1, 1, 0, 4, 1, 2, 1, 0, 4, 1, 1, 2, 0, 1, 4, 2, 1, 0, 1, 4, 1, 2, 0, 1, 4, 1, 1, 0, 2, 1, 4, 2, 0, 1, 1, 4, 1, 0, 2, 1, 4, 1, 0, 1, 2, 1, 4, 0, 2, 1, 1, 4, 0, 1, 2, 1, 4, 0, 1, 1, 2, 1, 2, 1, 1, 0, 0, 3, 2, 1, 0, 0, 3, 1, 2, 0, 0, 1, 2, 1, 0, 1, 0, 3, 2, 0, 1, 0, 3, 1, 0, 2, 0, 1, 2, 0, 1, 1, 0, 3, 0, 2, 1, 0, 3, 0, 1, 2, 0, 1, 2, 1, 0, 0, 1, 3, 2, 0, 0, 1, 3, 1, 0, 0, 2, 1, 2, 0, 1, 0, 1, 3, 0, 2, 0, 1, 3, 0, 1, 0, 2, 1, 2, 0, 0, 1, 1, 3, 0, 0, 2, 1, 3, 0, 0, 1, 2, 2, 3, 1, 1, 1, 0, 2, 1, 1, 1, -1, 2, 2, 0, 0, 0, 2, 3, 1, 1, 0, 1, 2, 1, 1, -1, 1, 2, 2, 0, 0, 0, 2, 3, 1, 0, 1, 1, 2, 1, -1, 1, 1, 2, 2, 0, 0, 0, 2, 3, 1, 1, 1, 0, 2, 1, 1, 1, -1, 2, 0, 2, 0, 0, 2, 3, 1, 1, 0, 1, 2, 1, 1, -1, 1, 2, 0, 2, 0, 0, 2, 3, 0, 1, 1, 1, 2, -1, 1, 1, 1, 2, 0, 2, 0, 0, 2, 3, 1, 1, 1, 0, 2, 1, 1, 1, -1, 2, 0, 0, 2, 0, 2, 3, 1, 0, 1, 1, 2, 1, -1, 1, 1, 2, 0, 0, 2, 0, 2, 3, 0, 1, 1, 1, 2, -1, 1, 1, 1, 2, 0, 0, 2, 0, 2, 3, 1, 1, 0, 1, 2, 1, 1, -1, 1, 2, 0, 0, 0, 2, 2, 3, 1, 0, 1, 1, 2, 1, -1, 1, 1, 2, 0, 0, 0, 2, 2, 3, 0, 1, 1, 1, 2, -1, 1, 1, 1, 2, 0, 0, 0, 2, 2, 1, 1, 1, -1, 0, 1, 1, 1, 0, -1, 0, 0, 0, 0, 0, 2, 1, 1, -1, 1, 0, 1, 1, 0, 1, -1, 0, 0, 0, 0, 0, 2, 1, -1, 1, 1, 0, 1, 0, 1, 1, -1, 0, 0, 0, 0, 0, 2, 1, 1, -1, 0, 1, 1, 1, 0, -1, 1, 0, 0, 0, 0, 0, 2, 1, -1, 1, 0, 1, 1, 0, 1, -1, 1, 0, 0, 0, 0, 0, 2, 1, -1, 0, 1, 1, 1, 0, -1, 1, 1, 0, 0, 0, 0, 0, 2, 1, 1, 1, -1, 0, 1, 1, 1, 0, -1, 2, 2, 0, 0, 0, 2, 1, 1, -1, 1, 0, 1, 1, 0, 1, -1, 2, 2, 0, 0, 0, 2, 1, 1, -1, 0, 1, 1, 1, 0, -1, 1, 2, 2, 0, 0, 0, 2, 1, 1, 1, -1, 0, 1, 1, 1, 0, -1, 2, 0, 2, 0, 0, 2, 1, -1, 1, 1, 0, 1, 0, 1, 1, -1, 2, 0, 2, 0, 0, 2, 1, -1, 1, 0, 1, 1, 0, 1, -1, 1, 2, 0, 2, 0, 0, 2, 1, 1, -1, 1, 0, 1, 1, 0, 1, -1, 2, 0, 0, 2, 0, 2, 1, -1, 1, 1, 0, 1, 0, 1, 1, -1, 2, 0, 0, 2, 0, 2, 1, -1, 0, 1, 1, 1, 0, -1, 1, 1, 2, 0, 0, 2, 0, 2, 1, 1, -1, 0, 1, 1, 1, 0, -1, 1, 2, 0, 0, 0, 2, 2, 1, -1, 1, 0, 1, 1, 0, 1, -1, 1, 2, 0, 0, 0, 2, 2, 1, -1, 0, 1, 1, 1, 0, -1, 1, 1, 2, 0, 0, 0, 2, 3, 1, 1, 0, 0, 0, 2, 2, 0, 0, 0, 2, 1, 1, 1, -1, 3, 1, 0, 1, 0, 0, 2, 0, 2, 0, 0, 2, 1, 1, 1, -1, 3, 1, 0, 0, 1, 0, 2, 0, 0, 2, 0, 2, 1, 1, 1, -1, 3, 1, 1, 0, 0, 0, 2, 2, 0, 0, 0, 2, 1, 1, -1, 1, 3, 1, 0, 1, 0, 0, 2, 0, 2, 0, 0, 2, 1, 1, -1, 1, 3, 1, 0, 0, 0, 1, 2, 0, 0, 0, 2, 2, 1, 1, -1, 1, 3, 1, 1, 0, 0, 0, 2, 2, 0, 0, 0, 2, 1, -1, 1, 1, 3, 1, 0, 0, 1, 0, 2, 0, 0, 2, 0, 2, 1, -1, 1, 1, 3, 1, 0, 0, 0, 1, 2, 0, 0, 0, 2, 2, 1, -1, 1, 1, 3, 1, 0, 1, 0, 0, 2, 0, 2, 0, 0, 2, -1, 1, 1, 1, 3, 1, 0, 0, 1, 0, 2, 0, 0, 2, 0, 2, -1, 1, 1, 1, 3, 1, 0, 0, 0, 1, 2, 0, 0, 0, 2, 2, -1, 1, 1, 1, 3, 3, 2, 1, 0, 0, 3, 1, 2, 0, 0, 4, 1, 1, 1, 1, 3, 3, 2, 0, 1, 0, 3, 1, 0, 2, 0, 4, 1, 1, 1, 1, 3, 3, 0, 2, 1, 0, 3, 0, 1, 2, 0, 4, 1, 1, 1, 1, 3, 3, 2, 0, 0, 1, 3, 1, 0, 0, 2, 4, 1, 1, 1, 1, 3, 3, 0, 2, 0, 1, 3, 0, 1, 0, 2, 4, 1, 1, 1, 1, 3, 3, 0, 0, 2, 1, 3, 0, 0, 1, 2, 4, 1, 1, 1, 1, 3, 3, 2, 1, 0, 0, 3, 1, 2, 0, 0, 2, 1, 1, 1, -1, 3, 3, 2, 0, 1, 0, 3, 1, 0, 2, 0, 2, 1, 1, 1, -1, 3, 3, 0, 2, 1, 0, 3, 0, 1, 2, 0, 2, 1, 1, 1, -1, 3, 3, 2, 1, 0, 0, 3, 1, 2, 0, 0, 2, 1, 1, -1, 1, 3, 3, 2, 0, 0, 1, 3, 1, 0, 0, 2, 2, 1, 1, -1, 1, 3, 3, 0, 2, 0, 1, 3, 0, 1, 0, 2, 2, 1, 1, -1, 1, 3, 3, 2, 0, 1, 0, 3, 1, 0, 2, 0, 2, 1, -1, 1, 1, 3, 3, 2, 0, 0, 1, 3, 1, 0, 0, 2, 2, 1, -1, 1, 1, 3, 3, 0, 0, 2, 1, 3, 0, 0, 1, 2, 2, 1, -1, 1, 1, 3, 3, 0, 2, 1, 0, 3, 0, 1, 2, 0, 2, -1, 1, 1, 1, 3, 3, 0, 2, 0, 1, 3, 0, 1, 0, 2, 2, -1, 1, 1, 1, 3, 3, 0, 0, 2, 1, 3, 0, 0, 1, 2, 2, -1, 1, 1, 1 };\n\t\tint[] lookupPairs4D = new int[] { 0, 3, 1, 2, 2, 3, 5, 2, 6, 1, 7, 1, 8, 3, 9, 2, 10, 3, 13, 2, 16, 3, 18, 3, 22, 1, 23, 1, 24, 3, 26, 3, 33, 2, 37, 2, 38, 1, 39, 1, 41, 2, 45, 2, 54, 1, 55, 1, 56, 0, 57, 0, 58, 0, 59, 0, 60, 0, 61, 0, 62, 0, 63, 0, 256, 3, 258, 3, 264, 3, 266, 3, 272, 3, 274, 3, 280, 3, 282, 3, 2049, 2, 2053, 2, 2057, 2, 2061, 2, 2081, 2, 2085, 2, 2089, 2, 2093, 2, 2304, 9, 2305, 9, 2312, 9, 2313, 9, 16390, 1, 16391, 1, 16406, 1, 16407, 1, 16422, 1, 16423, 1, 16438, 1, 16439, 1, 16642, 8, 16646, 8, 16658, 8, 16662, 8, 18437, 6, 18439, 6, 18469, 6, 18471, 6, 18688, 9, 18689, 9, 18690, 8, 18693, 6, 18694, 8, 18695, 6, 18696, 9, 18697, 9, 18706, 8, 18710, 8, 18725, 6, 18727, 6, 131128, 0, 131129, 0, 131130, 0, 131131, 0, 131132, 0, 131133, 0, 131134, 0, 131135, 0, 131352, 7, 131354, 7, 131384, 7, 131386, 7, 133161, 5, 133165, 5, 133177, 5, 133181, 5, 133376, 9, 133377, 9, 133384, 9, 133385, 9, 133400, 7, 133402, 7, 133417, 5, 133421, 5, 133432, 7, 133433, 5, 133434, 7, 133437, 5, 147510, 4, 147511, 4, 147518, 4, 147519, 4, 147714, 8, 147718, 8, 147730, 8, 147734, 8, 147736, 7, 147738, 7, 147766, 4, 147767, 4, 147768, 7, 147770, 7, 147774, 4, 147775, 4, 149509, 6, 149511, 6, 149541, 6, 149543, 6, 149545, 5, 149549, 5, 149558, 4, 149559, 4, 149561, 5, 149565, 5, 149566, 4, 149567, 4, 149760, 9, 149761, 9, 149762, 8, 149765, 6, 149766, 8, 149767, 6, 149768, 9, 149769, 9, 149778, 8, 149782, 8, 149784, 7, 149786, 7, 149797, 6, 149799, 6, 149801, 5, 149805, 5, 149814, 4, 149815, 4, 149816, 7, 149817, 5, 149818, 7, 149821, 5, 149822, 4, 149823, 4, 149824, 37, 149825, 37, 149826, 36, 149829, 34, 149830, 36, 149831, 34, 149832, 37, 149833, 37, 149842, 36, 149846, 36, 149848, 35, 149850, 35, 149861, 34, 149863, 34, 149865, 33, 149869, 33, 149878, 32, 149879, 32, 149880, 35, 149881, 33, 149882, 35, 149885, 33, 149886, 32, 149887, 32, 150080, 49, 150082, 48, 150088, 49, 150098, 48, 150104, 47, 150106, 47, 151873, 46, 151877, 45, 151881, 46, 151909, 45, 151913, 44, 151917, 44, 152128, 49, 152129, 46, 152136, 49, 152137, 46, 166214, 43, 166215, 42, 166230, 43, 166247, 42, 166262, 41, 166263, 41, 166466, 48, 166470, 43, 166482, 48, 166486, 43, 168261, 45, 168263, 42, 168293, 45, 168295, 42, 168512, 31, 168513, 28, 168514, 31, 168517, 28, 168518, 25, 168519, 25, 280952, 40, 280953, 39, 280954, 40, 280957, 39, 280958, 38, 280959, 38, 281176, 47, 281178, 47, 281208, 40, 281210, 40, 282985, 44, 282989, 44, 283001, 39, 283005, 39, 283208, 30, 283209, 27, 283224, 30, 283241, 27, 283256, 22, 283257, 22, 297334, 41, 297335, 41, 297342, 38, 297343, 38, 297554, 29, 297558, 24, 297562, 29, 297590, 24, 297594, 21, 297598, 21, 299365, 26, 299367, 23, 299373, 26, 299383, 23, 299389, 20, 299391, 20, 299584, 31, 299585, 28, 299586, 31, 299589, 28, 299590, 25, 299591, 25, 299592, 30, 299593, 27, 299602, 29, 299606, 24, 299608, 30, 299610, 29, 299621, 26, 299623, 23, 299625, 27, 299629, 26, 299638, 24, 299639, 23, 299640, 22, 299641, 22, 299642, 21, 299645, 20, 299646, 21, 299647, 20, 299648, 61, 299649, 60, 299650, 61, 299653, 60, 299654, 59, 299655, 59, 299656, 58, 299657, 57, 299666, 55, 299670, 54, 299672, 58, 299674, 55, 299685, 52, 299687, 51, 299689, 57, 299693, 52, 299702, 54, 299703, 51, 299704, 56, 299705, 56, 299706, 53, 299709, 50, 299710, 53, 299711, 50, 299904, 61, 299906, 61, 299912, 58, 299922, 55, 299928, 58, 299930, 55, 301697, 60, 301701, 60, 301705, 57, 301733, 52, 301737, 57, 301741, 52, 301952, 79, 301953, 79, 301960, 76, 301961, 76, 316038, 59, 316039, 59, 316054, 54, 316071, 51, 316086, 54, 316087, 51, 316290, 78, 316294, 78, 316306, 73, 316310, 73, 318085, 77, 318087, 77, 318117, 70, 318119, 70, 318336, 79, 318337, 79, 318338, 78, 318341, 77, 318342, 78, 318343, 77, 430776, 56, 430777, 56, 430778, 53, 430781, 50, 430782, 53, 430783, 50, 431000, 75, 431002, 72, 431032, 75, 431034, 72, 432809, 74, 432813, 69, 432825, 74, 432829, 69, 433032, 76, 433033, 76, 433048, 75, 433065, 74, 433080, 75, 433081, 74, 447158, 71, 447159, 68, 447166, 71, 447167, 68, 447378, 73, 447382, 73, 447386, 72, 447414, 71, 447418, 72, 447422, 71, 449189, 70, 449191, 70, 449197, 69, 449207, 68, 449213, 69, 449215, 68, 449408, 67, 449409, 67, 449410, 66, 449413, 64, 449414, 66, 449415, 64, 449416, 67, 449417, 67, 449426, 66, 449430, 66, 449432, 65, 449434, 65, 449445, 64, 449447, 64, 449449, 63, 449453, 63, 449462, 62, 449463, 62, 449464, 65, 449465, 63, 449466, 65, 449469, 63, 449470, 62, 449471, 62, 449472, 19, 449473, 19, 449474, 18, 449477, 16, 449478, 18, 449479, 16, 449480, 19, 449481, 19, 449490, 18, 449494, 18, 449496, 17, 449498, 17, 449509, 16, 449511, 16, 449513, 15, 449517, 15, 449526, 14, 449527, 14, 449528, 17, 449529, 15, 449530, 17, 449533, 15, 449534, 14, 449535, 14, 449728, 19, 449729, 19, 449730, 18, 449734, 18, 449736, 19, 449737, 19, 449746, 18, 449750, 18, 449752, 17, 449754, 17, 449784, 17, 449786, 17, 451520, 19, 451521, 19, 451525, 16, 451527, 16, 451528, 19, 451529, 19, 451557, 16, 451559, 16, 451561, 15, 451565, 15, 451577, 15, 451581, 15, 451776, 19, 451777, 19, 451784, 19, 451785, 19, 465858, 18, 465861, 16, 465862, 18, 465863, 16, 465874, 18, 465878, 18, 465893, 16, 465895, 16, 465910, 14, 465911, 14, 465918, 14, 465919, 14, 466114, 18, 466118, 18, 466130, 18, 466134, 18, 467909, 16, 467911, 16, 467941, 16, 467943, 16, 468160, 13, 468161, 13, 468162, 13, 468163, 13, 468164, 13, 468165, 13, 468166, 13, 468167, 13, 580568, 17, 580570, 17, 580585, 15, 580589, 15, 580598, 14, 580599, 14, 580600, 17, 580601, 15, 580602, 17, 580605, 15, 580606, 14, 580607, 14, 580824, 17, 580826, 17, 580856, 17, 580858, 17, 582633, 15, 582637, 15, 582649, 15, 582653, 15, 582856, 12, 582857, 12, 582872, 12, 582873, 12, 582888, 12, 582889, 12, 582904, 12, 582905, 12, 596982, 14, 596983, 14, 596990, 14, 596991, 14, 597202, 11, 597206, 11, 597210, 11, 597214, 11, 597234, 11, 597238, 11, 597242, 11, 597246, 11, 599013, 10, 599015, 10, 599021, 10, 599023, 10, 599029, 10, 599031, 10, 599037, 10, 599039, 10, 599232, 13, 599233, 13, 599234, 13, 599235, 13, 599236, 13, 599237, 13, 599238, 13, 599239, 13, 599240, 12, 599241, 12, 599250, 11, 599254, 11, 599256, 12, 599257, 12, 599258, 11, 599262, 11, 599269, 10, 599271, 10, 599272, 12, 599273, 12, 599277, 10, 599279, 10, 599282, 11, 599285, 10, 599286, 11, 599287, 10, 599288, 12, 599289, 12, 599290, 11, 599293, 10, 599294, 11, 599295, 10 };\n\t\tContribution4[] contributions4D = new Contribution4[p4D.length / 16];\n\t\tfor (int i = 0; i < p4D.length; i += 16) {\n\t\t\tint[] baseSet = base4D[p4D[i]];\n\t\t\tContribution4 previous = null, current = null;\n\t\t\tfor (int k = 0; k < baseSet.length; k += 5) {\n\t\t\t\tcurrent = new Contribution4(baseSet[k], baseSet[k + 1], baseSet[k + 2], baseSet[k + 3], baseSet[k + 4]);\n\t\t\t\tif (previous == null) {\n\t\t\t\t\tcontributions4D[i / 16] = current;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tprevious.next = current;\n\t\t\t\t}\n\t\t\t\tprevious = current;\n\t\t\t}\n\t\t\tcurrent.next = new Contribution4(p4D[i + 1], p4D[i + 2], p4D[i + 3], p4D[i + 4], p4D[i + 5]);\n\t\t\tcurrent.next.next = new Contribution4(p4D[i + 6], p4D[i + 7], p4D[i + 8], p4D[i + 9], p4D[i + 10]);\n\t\t\tcurrent.next.next.next = new Contribution4(p4D[i + 11], p4D[i + 12], p4D[i + 13], p4D[i + 14], p4D[i + 15]);\n\t\t}\n\n\t\tLOOKUP_4D = new Contribution4[1048576];\n\t\tfor (int i = 0; i < lookupPairs4D.length; i += 2) {\n\t\t\tLOOKUP_4D[lookupPairs4D[i]] = contributions4D[lookupPairs4D[i + 1]];\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "_old/java/legacy/UNLICENSE",
    "content": "This is free and unencumbered software released into the public domain.\n\nAnyone is free to copy, modify, publish, use, compile, sell, or\ndistribute this software, either in source code form or as a compiled\nbinary, for any purpose, commercial or non-commercial, and by any\nmeans.\n\nIn jurisdictions that recognize copyright laws, the author or authors\nof this software dedicate any and all copyright interest in the\nsoftware to the public domain. We make this dedication for the benefit\nof the public at large and to the detriment of our heirs and\nsuccessors. We intend this dedication to be an overt act of\nrelinquishment in perpetuity of all present and future rights to this\nsoftware under copyright law.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR\nOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\nFor more information, please refer to <https://unlicense.org>\n"
  },
  {
    "path": "_old/java/legacy_unoptimized/OpenSimplexUnoptimized.java",
    "content": "/**\n * K.jpg's original OpenSimplex Noise, unoptimized version\n * With updated gradient sets (Dec 2019, Feb 2020)\n * This is mostly provided for reference and sake of completeness.\n *\n * If 4D noise is not needed, is recommended to use OpenSimplex2 instead.\n * Choose OpenSimplex2S for comparable smoothness, or choose OpenSimplex2F for speed.\n * If 4D noise is needed, it is recommended to use the optimized OpenSimplex instead, at the current time.\n *\n * XYBeforeZ and XZBeforeY functions for 3D have been added, though they aren't as nice as in OpenSimplex2\n * XYBeforeZ replaces \"PlaneFirst\" which was added in Dec 2019, and XZBeforeY is similar.\n */\n \npublic class OpenSimplexUnoptimized {\n\n\tprivate static final double STRETCH_CONSTANT_2D = -0.211324865405187;    // (1/Math.sqrt(2+1)-1)/2;\n\tprivate static final double SQUISH_CONSTANT_2D = 0.366025403784439;      // (Math.sqrt(2+1)-1)/2;\n\tprivate static final double STRETCH_CONSTANT_3D = -1.0 / 6;              // (1/Math.sqrt(3+1)-1)/3;\n\tprivate static final double SQUISH_CONSTANT_3D = 1.0 / 3;                // (Math.sqrt(3+1)-1)/3;\n\tprivate static final double STRETCH_CONSTANT_4D = -0.138196601125011;    // (1/Math.sqrt(4+1)-1)/4;\n\tprivate static final double SQUISH_CONSTANT_4D = 0.309016994374947;      // (Math.sqrt(4+1)-1)/4;\n\t\n\tprivate static final long DEFAULT_SEED = 0;\n\t\n\tprivate static final int PSIZE = 2048;\n\tprivate static final int PMASK = 2047;\n\n\tprivate short[] perm;\n\tprivate Grad2[] permGrad2;\n\tprivate Grad3[] permGrad3;\n\tprivate Grad4[] permGrad4;\n\t\n\tpublic OpenSimplexUnoptimized() {\n\t\tthis(DEFAULT_SEED);\n\t}\n\t\n\tpublic OpenSimplexUnoptimized(short[] perm) {\n\t\tthis.perm = perm;\n\t\tpermGrad2 = new Grad2[PSIZE];\n\t\tpermGrad3 = new Grad3[PSIZE];\n\t\tpermGrad4 = new Grad4[PSIZE];\n\t\t\n\t\tfor (int i = 0; i < PSIZE; i++) {\n\t\t\tpermGrad2[i] = GRADIENTS_2D[perm[i]];\n\t\t\tpermGrad3[i] = GRADIENTS_3D[perm[i]];\n\t\t\tpermGrad4[i] = GRADIENTS_4D[perm[i]];\n\t\t}\n\t}\n\t\n\tpublic OpenSimplexUnoptimized(long seed) {\n\t\tperm = new short[PSIZE];\n\t\tpermGrad2 = new Grad2[PSIZE];\n\t\tpermGrad3 = new Grad3[PSIZE];\n\t\tpermGrad4 = new Grad4[PSIZE];\n\t\tshort[] source = new short[PSIZE]; \n\t\tfor (short i = 0; i < PSIZE; i++)\n\t\t\tsource[i] = i;\n\t\tfor (int i = PSIZE - 1; i >= 0; i--) {\n\t\t\tseed = seed * 6364136223846793005L + 1442695040888963407L;\n\t\t\tint r = (int)((seed + 31) % (i + 1));\n\t\t\tif (r < 0)\n\t\t\t\tr += (i + 1);\n\t\t\tperm[i] = source[r];\n\t\t\tpermGrad2[i] = GRADIENTS_2D[perm[i]];\n\t\t\tpermGrad3[i] = GRADIENTS_3D[perm[i]];\n\t\t\tpermGrad4[i] = GRADIENTS_4D[perm[i]];\n\t\t\tsource[r] = source[i];\n\t\t}\n\t}\n\t\n\t// 2D OpenSimplex Noise.\n\tpublic double eval(double x, double y) {\n\t\n\t\t// Place input coordinates onto grid.\n\t\tdouble stretchOffset = (x + y) * STRETCH_CONSTANT_2D;\n\t\tdouble xs = x + stretchOffset;\n\t\tdouble ys = y + stretchOffset;\n\t\t\n\t\t// Floor to get grid coordinates of rhombus (stretched square) super-cell origin.\n\t\tint xsb = fastFloor(xs);\n\t\tint ysb = fastFloor(ys);\n\t\t\n\t\t// Compute grid coordinates relative to rhombus origin.\n\t\tdouble xins = xs - xsb;\n\t\tdouble yins = ys - ysb;\n\t\t\n\t\t// Sum those together to get a value that determines which region we're in.\n\t\tdouble inSum = xins + yins;\n\n\t\t// Positions relative to origin point.\n\t\tdouble squishOffsetIns = inSum * SQUISH_CONSTANT_2D;\n\t\tdouble dx0 = xins + squishOffsetIns;\n\t\tdouble dy0 = yins + squishOffsetIns;\n\t\t\n\t\t// We'll be defining these inside the next block and using them afterwards.\n\t\tdouble dx_ext, dy_ext;\n\t\tint xsv_ext, ysv_ext;\n\t\t\n\t\tdouble value = 0;\n\n\t\t// Contribution (1,0)\n\t\tdouble dx1 = dx0 - 1 - SQUISH_CONSTANT_2D;\n\t\tdouble dy1 = dy0 - 0 - SQUISH_CONSTANT_2D;\n\t\tdouble attn1 = 2 - dx1 * dx1 - dy1 * dy1;\n\t\tif (attn1 > 0) {\n\t\t\tattn1 *= attn1;\n\t\t\tvalue += attn1 * attn1 * extrapolate(xsb + 1, ysb + 0, dx1, dy1);\n\t\t}\n\n\t\t// Contribution (0,1)\n\t\tdouble dx2 = dx0 - 0 - SQUISH_CONSTANT_2D;\n\t\tdouble dy2 = dy0 - 1 - SQUISH_CONSTANT_2D;\n\t\tdouble attn2 = 2 - dx2 * dx2 - dy2 * dy2;\n\t\tif (attn2 > 0) {\n\t\t\tattn2 *= attn2;\n\t\t\tvalue += attn2 * attn2 * extrapolate(xsb + 0, ysb + 1, dx2, dy2);\n\t\t}\n\t\t\n\t\tif (inSum <= 1) { // We're inside the triangle (2-Simplex) at (0,0)\n\t\t\tdouble zins = 1 - inSum;\n\t\t\tif (zins > xins || zins > yins) { // (0,0) is one of the closest two triangular vertices\n\t\t\t\tif (xins > yins) {\n\t\t\t\t\txsv_ext = xsb + 1;\n\t\t\t\t\tysv_ext = ysb - 1;\n\t\t\t\t\tdx_ext = dx0 - 1;\n\t\t\t\t\tdy_ext = dy0 + 1;\n\t\t\t\t} else {\n\t\t\t\t\txsv_ext = xsb - 1;\n\t\t\t\t\tysv_ext = ysb + 1;\n\t\t\t\t\tdx_ext = dx0 + 1;\n\t\t\t\t\tdy_ext = dy0 - 1;\n\t\t\t\t}\n\t\t\t} else { // (1,0) and (0,1) are the closest two vertices.\n\t\t\t\txsv_ext = xsb + 1;\n\t\t\t\tysv_ext = ysb + 1;\n\t\t\t\tdx_ext = dx0 - 1 - 2 * SQUISH_CONSTANT_2D;\n\t\t\t\tdy_ext = dy0 - 1 - 2 * SQUISH_CONSTANT_2D;\n\t\t\t}\n\t\t} else { // We're inside the triangle (2-Simplex) at (1,1)\n\t\t\tdouble zins = 2 - inSum;\n\t\t\tif (zins < xins || zins < yins) { // (0,0) is one of the closest two triangular vertices\n\t\t\t\tif (xins > yins) {\n\t\t\t\t\txsv_ext = xsb + 2;\n\t\t\t\t\tysv_ext = ysb + 0;\n\t\t\t\t\tdx_ext = dx0 - 2 - 2 * SQUISH_CONSTANT_2D;\n\t\t\t\t\tdy_ext = dy0 + 0 - 2 * SQUISH_CONSTANT_2D;\n\t\t\t\t} else {\n\t\t\t\t\txsv_ext = xsb + 0;\n\t\t\t\t\tysv_ext = ysb + 2;\n\t\t\t\t\tdx_ext = dx0 + 0 - 2 * SQUISH_CONSTANT_2D;\n\t\t\t\t\tdy_ext = dy0 - 2 - 2 * SQUISH_CONSTANT_2D;\n\t\t\t\t}\n\t\t\t} else { // (1,0) and (0,1) are the closest two vertices.\n\t\t\t\tdx_ext = dx0;\n\t\t\t\tdy_ext = dy0;\n\t\t\t\txsv_ext = xsb;\n\t\t\t\tysv_ext = ysb;\n\t\t\t}\n\t\t\txsb += 1;\n\t\t\tysb += 1;\n\t\t\tdx0 = dx0 - 1 - 2 * SQUISH_CONSTANT_2D;\n\t\t\tdy0 = dy0 - 1 - 2 * SQUISH_CONSTANT_2D;\n\t\t}\n\t\t\n\t\t// Contribution (0,0) or (1,1)\n\t\tdouble attn0 = 2 - dx0 * dx0 - dy0 * dy0;\n\t\tif (attn0 > 0) {\n\t\t\tattn0 *= attn0;\n\t\t\tvalue += attn0 * attn0 * extrapolate(xsb, ysb, dx0, dy0);\n\t\t}\n\t\t\n\t\t// Extra Vertex\n\t\tdouble attn_ext = 2 - dx_ext * dx_ext - dy_ext * dy_ext;\n\t\tif (attn_ext > 0) {\n\t\t\tattn_ext *= attn_ext;\n\t\t\tvalue += attn_ext * attn_ext * extrapolate(xsv_ext, ysv_ext, dx_ext, dy_ext);\n\t\t}\n\t\t\n\t\treturn value;\n\t}\n\t\n\t// 3D OpenSimplex Noise.\n\tpublic double eval(double x, double y, double z) {\n\t\n\t\t// Place input coordinates on simplectic honeycomb.\n\t\tdouble stretchOffset = (x + y + z) * STRETCH_CONSTANT_3D;\n\t\tdouble xs = x + stretchOffset;\n\t\tdouble ys = y + stretchOffset;\n\t\tdouble zs = z + stretchOffset;\n\t\t\n\t\treturn eval3_Base(xs, ys, zs);\n\t}\n\n\t// Not as good as in SuperSimplex/OpenSimplex2S, since there are more visible differences between different slices.\n\t// The Z coordinate should always be the \"different\" coordinate in your use case.\n\tpublic double eval3_XYBeforeZ(double x, double y, double z)\n\t{\n\t\t// Combine rotation with skew transform.\n\t\tdouble xy = x + y;\n\t\tdouble s2 = xy * 0.211324865405187;\n\t\tdouble zz = z * 0.288675134594813;\n\t\tdouble xs = s2 - x + zz, ys = s2 - y + zz;\n\t\tdouble zs = xy * 0.577350269189626 + zz;\n\n\t\treturn eval3_Base(xs, ys, zs);\n\t}\n\n\t// Similar to the above, except the Y coordinate should always be the \"different\" coordinate in your use case.\n\tpublic double eval3_XZBeforeY(double x, double y, double z)\n\t{\n\t\t// Combine rotation with skew transform.\n\t\tdouble xz = x + z;\n\t\tdouble s2 = xz * 0.211324865405187;\n\t\tdouble yy = y * 0.288675134594813;\n\t\tdouble xs = s2 - x + yy, zs = s2 - z + yy;\n\t\tdouble ys = xz * 0.577350269189626 + yy;\n\n\t\treturn eval3_Base(xs, ys, zs);\n\t}\n\t\n\t// 3D OpenSimplex Noise (base which takes skewed coordinates directly).\n\tprivate double eval3_Base(double xs, double ys, double zs) {\n\t\t\n\t\t// Floor to get simplectic honeycomb coordinates of rhombohedron (stretched cube) super-cell origin.\n\t\tint xsb = fastFloor(xs);\n\t\tint ysb = fastFloor(ys);\n\t\tint zsb = fastFloor(zs);\n\t\t\n\t\t// Compute simplectic honeycomb coordinates relative to rhombohedral origin.\n\t\tdouble xins = xs - xsb;\n\t\tdouble yins = ys - ysb;\n\t\tdouble zins = zs - zsb;\n\t\t\n\t\t// Sum those together to get a value that determines which region we're in.\n\t\tdouble inSum = xins + yins + zins;\n\n\t\t// Positions relative to origin point.\n\t\tdouble squishOffsetIns = inSum * SQUISH_CONSTANT_3D;\n\t\tdouble dx0 = xins + squishOffsetIns;\n\t\tdouble dy0 = yins + squishOffsetIns;\n\t\tdouble dz0 = zins + squishOffsetIns;\n\t\t\n\t\t// We'll be defining these inside the next block and using them afterwards.\n\t\tdouble dx_ext0, dy_ext0, dz_ext0;\n\t\tdouble dx_ext1, dy_ext1, dz_ext1;\n\t\tint xsv_ext0, ysv_ext0, zsv_ext0;\n\t\tint xsv_ext1, ysv_ext1, zsv_ext1;\n\t\t\n\t\tdouble value = 0;\n\t\tif (inSum <= 1) { // We're inside the tetrahedron (3-Simplex) at (0,0,0)\n\t\t\t\n\t\t\t// Determine which two of (0,0,1), (0,1,0), (1,0,0) are closest.\n\t\t\tbyte aPoint = 0x01;\n\t\t\tdouble aScore = xins;\n\t\t\tbyte bPoint = 0x02;\n\t\t\tdouble bScore = yins;\n\t\t\tif (aScore >= bScore && zins > bScore) {\n\t\t\t\tbScore = zins;\n\t\t\t\tbPoint = 0x04;\n\t\t\t} else if (aScore < bScore && zins > aScore) {\n\t\t\t\taScore = zins;\n\t\t\t\taPoint = 0x04;\n\t\t\t}\n\t\t\t\n\t\t\t// Now we determine the two lattice points not part of the tetrahedron that may contribute.\n\t\t\t// This depends on the closest two tetrahedral vertices, including (0,0,0)\n\t\t\tdouble wins = 1 - inSum;\n\t\t\tif (wins > aScore || wins > bScore) { // (0,0,0) is one of the closest two tetrahedral vertices.\n\t\t\t\tbyte c = (bScore > aScore ? bPoint : aPoint); // Our other closest vertex is the closest out of a and b.\n\t\t\t\t\n\t\t\t\tif ((c & 0x01) == 0) {\n\t\t\t\t\txsv_ext0 = xsb - 1;\n\t\t\t\t\txsv_ext1 = xsb;\n\t\t\t\t\tdx_ext0 = dx0 + 1;\n\t\t\t\t\tdx_ext1 = dx0;\n\t\t\t\t} else {\n\t\t\t\t\txsv_ext0 = xsv_ext1 = xsb + 1;\n\t\t\t\t\tdx_ext0 = dx_ext1 = dx0 - 1;\n\t\t\t\t}\n\n\t\t\t\tif ((c & 0x02) == 0) {\n\t\t\t\t\tysv_ext0 = ysv_ext1 = ysb;\n\t\t\t\t\tdy_ext0 = dy_ext1 = dy0;\n\t\t\t\t\tif ((c & 0x01) == 0) {\n\t\t\t\t\t\tysv_ext1 -= 1;\n\t\t\t\t\t\tdy_ext1 += 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tysv_ext0 -= 1;\n\t\t\t\t\t\tdy_ext0 += 1;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tysv_ext0 = ysv_ext1 = ysb + 1;\n\t\t\t\t\tdy_ext0 = dy_ext1 = dy0 - 1;\n\t\t\t\t}\n\n\t\t\t\tif ((c & 0x04) == 0) {\n\t\t\t\t\tzsv_ext0 = zsb;\n\t\t\t\t\tzsv_ext1 = zsb - 1;\n\t\t\t\t\tdz_ext0 = dz0;\n\t\t\t\t\tdz_ext1 = dz0 + 1;\n\t\t\t\t} else {\n\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsb + 1;\n\t\t\t\t\tdz_ext0 = dz_ext1 = dz0 - 1;\n\t\t\t\t}\n\t\t\t} else { // (0,0,0) is not one of the closest two tetrahedral vertices.\n\t\t\t\tbyte c = (byte)(aPoint | bPoint); // Our two extra vertices are determined by the closest two.\n\t\t\t\t\n\t\t\t\tif ((c & 0x01) == 0) {\n\t\t\t\t\txsv_ext0 = xsb;\n\t\t\t\t\txsv_ext1 = xsb - 1;\n\t\t\t\t\tdx_ext0 = dx0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t\tdx_ext1 = dx0 + 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t} else {\n\t\t\t\t\txsv_ext0 = xsv_ext1 = xsb + 1;\n\t\t\t\t\tdx_ext0 = dx0 - 1 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t\tdx_ext1 = dx0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t}\n\n\t\t\t\tif ((c & 0x02) == 0) {\n\t\t\t\t\tysv_ext0 = ysb;\n\t\t\t\t\tysv_ext1 = ysb - 1;\n\t\t\t\t\tdy_ext0 = dy0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t\tdy_ext1 = dy0 + 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t} else {\n\t\t\t\t\tysv_ext0 = ysv_ext1 = ysb + 1;\n\t\t\t\t\tdy_ext0 = dy0 - 1 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t\tdy_ext1 = dy0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t}\n\n\t\t\t\tif ((c & 0x04) == 0) {\n\t\t\t\t\tzsv_ext0 = zsb;\n\t\t\t\t\tzsv_ext1 = zsb - 1;\n\t\t\t\t\tdz_ext0 = dz0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t\tdz_ext1 = dz0 + 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t} else {\n\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsb + 1;\n\t\t\t\t\tdz_ext0 = dz0 - 1 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t\tdz_ext1 = dz0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Contribution (0,0,0)\n\t\t\tdouble attn0 = 2 - dx0 * dx0 - dy0 * dy0 - dz0 * dz0;\n\t\t\tif (attn0 > 0) {\n\t\t\t\tattn0 *= attn0;\n\t\t\t\tvalue += attn0 * attn0 * extrapolate(xsb + 0, ysb + 0, zsb + 0, dx0, dy0, dz0);\n\t\t\t}\n\n\t\t\t// Contribution (1,0,0)\n\t\t\tdouble dx1 = dx0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\tdouble dy1 = dy0 - 0 - SQUISH_CONSTANT_3D;\n\t\t\tdouble dz1 = dz0 - 0 - SQUISH_CONSTANT_3D;\n\t\t\tdouble attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1;\n\t\t\tif (attn1 > 0) {\n\t\t\t\tattn1 *= attn1;\n\t\t\t\tvalue += attn1 * attn1 * extrapolate(xsb + 1, ysb + 0, zsb + 0, dx1, dy1, dz1);\n\t\t\t}\n\n\t\t\t// Contribution (0,1,0)\n\t\t\tdouble dx2 = dx0 - 0 - SQUISH_CONSTANT_3D;\n\t\t\tdouble dy2 = dy0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\tdouble dz2 = dz1;\n\t\t\tdouble attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2;\n\t\t\tif (attn2 > 0) {\n\t\t\t\tattn2 *= attn2;\n\t\t\t\tvalue += attn2 * attn2 * extrapolate(xsb + 0, ysb + 1, zsb + 0, dx2, dy2, dz2);\n\t\t\t}\n\n\t\t\t// Contribution (0,0,1)\n\t\t\tdouble dx3 = dx2;\n\t\t\tdouble dy3 = dy1;\n\t\t\tdouble dz3 = dz0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\tdouble attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3;\n\t\t\tif (attn3 > 0) {\n\t\t\t\tattn3 *= attn3;\n\t\t\t\tvalue += attn3 * attn3 * extrapolate(xsb + 0, ysb + 0, zsb + 1, dx3, dy3, dz3);\n\t\t\t}\n\t\t} else if (inSum >= 2) { // We're inside the tetrahedron (3-Simplex) at (1,1,1)\n\t\t\n\t\t\t// Determine which two tetrahedral vertices are the closest, out of (1,1,0), (1,0,1), (0,1,1) but not (1,1,1).\n\t\t\tbyte aPoint = 0x06;\n\t\t\tdouble aScore = xins;\n\t\t\tbyte bPoint = 0x05;\n\t\t\tdouble bScore = yins;\n\t\t\tif (aScore <= bScore && zins < bScore) {\n\t\t\t\tbScore = zins;\n\t\t\t\tbPoint = 0x03;\n\t\t\t} else if (aScore > bScore && zins < aScore) {\n\t\t\t\taScore = zins;\n\t\t\t\taPoint = 0x03;\n\t\t\t}\n\t\t\t\n\t\t\t// Now we determine the two lattice points not part of the tetrahedron that may contribute.\n\t\t\t// This depends on the closest two tetrahedral vertices, including (1,1,1)\n\t\t\tdouble wins = 3 - inSum;\n\t\t\tif (wins < aScore || wins < bScore) { // (1,1,1) is one of the closest two tetrahedral vertices.\n\t\t\t\tbyte c = (bScore < aScore ? bPoint : aPoint); // Our other closest vertex is the closest out of a and b.\n\t\t\t\t\n\t\t\t\tif ((c & 0x01) != 0) {\n\t\t\t\t\txsv_ext0 = xsb + 2;\n\t\t\t\t\txsv_ext1 = xsb + 1;\n\t\t\t\t\tdx_ext0 = dx0 - 2 - 3 * SQUISH_CONSTANT_3D;\n\t\t\t\t\tdx_ext1 = dx0 - 1 - 3 * SQUISH_CONSTANT_3D;\n\t\t\t\t} else {\n\t\t\t\t\txsv_ext0 = xsv_ext1 = xsb;\n\t\t\t\t\tdx_ext0 = dx_ext1 = dx0 - 3 * SQUISH_CONSTANT_3D;\n\t\t\t\t}\n\n\t\t\t\tif ((c & 0x02) != 0) {\n\t\t\t\t\tysv_ext0 = ysv_ext1 = ysb + 1;\n\t\t\t\t\tdy_ext0 = dy_ext1 = dy0 - 1 - 3 * SQUISH_CONSTANT_3D;\n\t\t\t\t\tif ((c & 0x01) != 0) {\n\t\t\t\t\t\tysv_ext1 += 1;\n\t\t\t\t\t\tdy_ext1 -= 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tysv_ext0 += 1;\n\t\t\t\t\t\tdy_ext0 -= 1;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tysv_ext0 = ysv_ext1 = ysb;\n\t\t\t\t\tdy_ext0 = dy_ext1 = dy0 - 3 * SQUISH_CONSTANT_3D;\n\t\t\t\t}\n\n\t\t\t\tif ((c & 0x04) != 0) {\n\t\t\t\t\tzsv_ext0 = zsb + 1;\n\t\t\t\t\tzsv_ext1 = zsb + 2;\n\t\t\t\t\tdz_ext0 = dz0 - 1 - 3 * SQUISH_CONSTANT_3D;\n\t\t\t\t\tdz_ext1 = dz0 - 2 - 3 * SQUISH_CONSTANT_3D;\n\t\t\t\t} else {\n\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsb;\n\t\t\t\t\tdz_ext0 = dz_ext1 = dz0 - 3 * SQUISH_CONSTANT_3D;\n\t\t\t\t}\n\t\t\t} else { // (1,1,1) is not one of the closest two tetrahedral vertices.\n\t\t\t\tbyte c = (byte)(aPoint & bPoint); // Our two extra vertices are determined by the closest two.\n\t\t\t\t\n\t\t\t\tif ((c & 0x01) != 0) {\n\t\t\t\t\txsv_ext0 = xsb + 1;\n\t\t\t\t\txsv_ext1 = xsb + 2;\n\t\t\t\t\tdx_ext0 = dx0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\tdx_ext1 = dx0 - 2 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t} else {\n\t\t\t\t\txsv_ext0 = xsv_ext1 = xsb;\n\t\t\t\t\tdx_ext0 = dx0 - SQUISH_CONSTANT_3D;\n\t\t\t\t\tdx_ext1 = dx0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t}\n\n\t\t\t\tif ((c & 0x02) != 0) {\n\t\t\t\t\tysv_ext0 = ysb + 1;\n\t\t\t\t\tysv_ext1 = ysb + 2;\n\t\t\t\t\tdy_ext0 = dy0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\tdy_ext1 = dy0 - 2 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t} else {\n\t\t\t\t\tysv_ext0 = ysv_ext1 = ysb;\n\t\t\t\t\tdy_ext0 = dy0 - SQUISH_CONSTANT_3D;\n\t\t\t\t\tdy_ext1 = dy0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t}\n\n\t\t\t\tif ((c & 0x04) != 0) {\n\t\t\t\t\tzsv_ext0 = zsb + 1;\n\t\t\t\t\tzsv_ext1 = zsb + 2;\n\t\t\t\t\tdz_ext0 = dz0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\tdz_ext1 = dz0 - 2 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t} else {\n\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsb;\n\t\t\t\t\tdz_ext0 = dz0 - SQUISH_CONSTANT_3D;\n\t\t\t\t\tdz_ext1 = dz0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// Contribution (1,1,0)\n\t\t\tdouble dx3 = dx0 - 1 - 2 * SQUISH_CONSTANT_3D;\n\t\t\tdouble dy3 = dy0 - 1 - 2 * SQUISH_CONSTANT_3D;\n\t\t\tdouble dz3 = dz0 - 0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\tdouble attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3;\n\t\t\tif (attn3 > 0) {\n\t\t\t\tattn3 *= attn3;\n\t\t\t\tvalue += attn3 * attn3 * extrapolate(xsb + 1, ysb + 1, zsb + 0, dx3, dy3, dz3);\n\t\t\t}\n\n\t\t\t// Contribution (1,0,1)\n\t\t\tdouble dx2 = dx3;\n\t\t\tdouble dy2 = dy0 - 0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\tdouble dz2 = dz0 - 1 - 2 * SQUISH_CONSTANT_3D;\n\t\t\tdouble attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2;\n\t\t\tif (attn2 > 0) {\n\t\t\t\tattn2 *= attn2;\n\t\t\t\tvalue += attn2 * attn2 * extrapolate(xsb + 1, ysb + 0, zsb + 1, dx2, dy2, dz2);\n\t\t\t}\n\n\t\t\t// Contribution (0,1,1)\n\t\t\tdouble dx1 = dx0 - 0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\tdouble dy1 = dy3;\n\t\t\tdouble dz1 = dz2;\n\t\t\tdouble attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1;\n\t\t\tif (attn1 > 0) {\n\t\t\t\tattn1 *= attn1;\n\t\t\t\tvalue += attn1 * attn1 * extrapolate(xsb + 0, ysb + 1, zsb + 1, dx1, dy1, dz1);\n\t\t\t}\n\n\t\t\t// Contribution (1,1,1)\n\t\t\tdx0 = dx0 - 1 - 3 * SQUISH_CONSTANT_3D;\n\t\t\tdy0 = dy0 - 1 - 3 * SQUISH_CONSTANT_3D;\n\t\t\tdz0 = dz0 - 1 - 3 * SQUISH_CONSTANT_3D;\n\t\t\tdouble attn0 = 2 - dx0 * dx0 - dy0 * dy0 - dz0 * dz0;\n\t\t\tif (attn0 > 0) {\n\t\t\t\tattn0 *= attn0;\n\t\t\t\tvalue += attn0 * attn0 * extrapolate(xsb + 1, ysb + 1, zsb + 1, dx0, dy0, dz0);\n\t\t\t}\n\t\t} else { // We're inside the octahedron (Rectified 3-Simplex) in between.\n\t\t\tdouble aScore;\n\t\t\tbyte aPoint;\n\t\t\tboolean aIsFurtherSide;\n\t\t\tdouble bScore;\n\t\t\tbyte bPoint;\n\t\t\tboolean bIsFurtherSide;\n\n\t\t\t// Decide between point (0,0,1) and (1,1,0) as closest\n\t\t\tdouble p1 = xins + yins;\n\t\t\tif (p1 > 1) {\n\t\t\t\taScore = p1 - 1;\n\t\t\t\taPoint = 0x03;\n\t\t\t\taIsFurtherSide = true;\n\t\t\t} else {\n\t\t\t\taScore = 1 - p1;\n\t\t\t\taPoint = 0x04;\n\t\t\t\taIsFurtherSide = false;\n\t\t\t}\n\n\t\t\t// Decide between point (0,1,0) and (1,0,1) as closest\n\t\t\tdouble p2 = xins + zins;\n\t\t\tif (p2 > 1) {\n\t\t\t\tbScore = p2 - 1;\n\t\t\t\tbPoint = 0x05;\n\t\t\t\tbIsFurtherSide = true;\n\t\t\t} else {\n\t\t\t\tbScore = 1 - p2;\n\t\t\t\tbPoint = 0x02;\n\t\t\t\tbIsFurtherSide = false;\n\t\t\t}\n\t\t\t\n\t\t\t// The closest out of the two (1,0,0) and (0,1,1) will replace the furthest out of the two decided above, if closer.\n\t\t\tdouble p3 = yins + zins;\n\t\t\tif (p3 > 1) {\n\t\t\t\tdouble score = p3 - 1;\n\t\t\t\tif (aScore <= bScore && aScore < score) {\n\t\t\t\t\taScore = score;\n\t\t\t\t\taPoint = 0x06;\n\t\t\t\t\taIsFurtherSide = true;\n\t\t\t\t} else if (aScore > bScore && bScore < score) {\n\t\t\t\t\tbScore = score;\n\t\t\t\t\tbPoint = 0x06;\n\t\t\t\t\tbIsFurtherSide = true;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdouble score = 1 - p3;\n\t\t\t\tif (aScore <= bScore && aScore < score) {\n\t\t\t\t\taScore = score;\n\t\t\t\t\taPoint = 0x01;\n\t\t\t\t\taIsFurtherSide = false;\n\t\t\t\t} else if (aScore > bScore && bScore < score) {\n\t\t\t\t\tbScore = score;\n\t\t\t\t\tbPoint = 0x01;\n\t\t\t\t\tbIsFurtherSide = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// Where each of the two closest points are determines how the extra two vertices are calculated.\n\t\t\tif (aIsFurtherSide == bIsFurtherSide) {\n\t\t\t\tif (aIsFurtherSide) { // Both closest points on (1,1,1) side\n\n\t\t\t\t\t// One of the two extra points is (1,1,1)\n\t\t\t\t\tdx_ext0 = dx0 - 1 - 3 * SQUISH_CONSTANT_3D;\n\t\t\t\t\tdy_ext0 = dy0 - 1 - 3 * SQUISH_CONSTANT_3D;\n\t\t\t\t\tdz_ext0 = dz0 - 1 - 3 * SQUISH_CONSTANT_3D;\n\t\t\t\t\txsv_ext0 = xsb + 1;\n\t\t\t\t\tysv_ext0 = ysb + 1;\n\t\t\t\t\tzsv_ext0 = zsb + 1;\n\n\t\t\t\t\t// Other extra point is based on the shared axis.\n\t\t\t\t\tbyte c = (byte)(aPoint & bPoint);\n\t\t\t\t\tif ((c & 0x01) != 0) {\n\t\t\t\t\t\tdx_ext1 = dx0 - 2 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t\t\tdy_ext1 = dy0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t\t\tdz_ext1 = dz0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t\t\txsv_ext1 = xsb + 2;\n\t\t\t\t\t\tysv_ext1 = ysb;\n\t\t\t\t\t\tzsv_ext1 = zsb;\n\t\t\t\t\t} else if ((c & 0x02) != 0) {\n\t\t\t\t\t\tdx_ext1 = dx0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t\t\tdy_ext1 = dy0 - 2 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t\t\tdz_ext1 = dz0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t\t\txsv_ext1 = xsb;\n\t\t\t\t\t\tysv_ext1 = ysb + 2;\n\t\t\t\t\t\tzsv_ext1 = zsb;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdx_ext1 = dx0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t\t\tdy_ext1 = dy0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t\t\tdz_ext1 = dz0 - 2 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\t\t\txsv_ext1 = xsb;\n\t\t\t\t\t\tysv_ext1 = ysb;\n\t\t\t\t\t\tzsv_ext1 = zsb + 2;\n\t\t\t\t\t}\n\t\t\t\t} else {// Both closest points on (0,0,0) side\n\n\t\t\t\t\t// One of the two extra points is (0,0,0)\n\t\t\t\t\tdx_ext0 = dx0;\n\t\t\t\t\tdy_ext0 = dy0;\n\t\t\t\t\tdz_ext0 = dz0;\n\t\t\t\t\txsv_ext0 = xsb;\n\t\t\t\t\tysv_ext0 = ysb;\n\t\t\t\t\tzsv_ext0 = zsb;\n\n\t\t\t\t\t// Other extra point is based on the omitted axis.\n\t\t\t\t\tbyte c = (byte)(aPoint | bPoint);\n\t\t\t\t\tif ((c & 0x01) == 0) {\n\t\t\t\t\t\tdx_ext1 = dx0 + 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\t\tdy_ext1 = dy0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\t\tdz_ext1 = dz0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\t\txsv_ext1 = xsb - 1;\n\t\t\t\t\t\tysv_ext1 = ysb + 1;\n\t\t\t\t\t\tzsv_ext1 = zsb + 1;\n\t\t\t\t\t} else if ((c & 0x02) == 0) {\n\t\t\t\t\t\tdx_ext1 = dx0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\t\tdy_ext1 = dy0 + 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\t\tdz_ext1 = dz0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\t\txsv_ext1 = xsb + 1;\n\t\t\t\t\t\tysv_ext1 = ysb - 1;\n\t\t\t\t\t\tzsv_ext1 = zsb + 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdx_ext1 = dx0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\t\tdy_ext1 = dy0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\t\tdz_ext1 = dz0 + 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\t\txsv_ext1 = xsb + 1;\n\t\t\t\t\t\tysv_ext1 = ysb + 1;\n\t\t\t\t\t\tzsv_ext1 = zsb - 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else { // One point on (0,0,0) side, one point on (1,1,1) side\n\t\t\t\tbyte c1, c2;\n\t\t\t\tif (aIsFurtherSide) {\n\t\t\t\t\tc1 = aPoint;\n\t\t\t\t\tc2 = bPoint;\n\t\t\t\t} else {\n\t\t\t\t\tc1 = bPoint;\n\t\t\t\t\tc2 = aPoint;\n\t\t\t\t}\n\n\t\t\t\t// One contribution is a permutation of (1,1,-1)\n\t\t\t\tif ((c1 & 0x01) == 0) {\n\t\t\t\t\tdx_ext0 = dx0 + 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\tdy_ext0 = dy0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\tdz_ext0 = dz0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\txsv_ext0 = xsb - 1;\n\t\t\t\t\tysv_ext0 = ysb + 1;\n\t\t\t\t\tzsv_ext0 = zsb + 1;\n\t\t\t\t} else if ((c1 & 0x02) == 0) {\n\t\t\t\t\tdx_ext0 = dx0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\tdy_ext0 = dy0 + 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\tdz_ext0 = dz0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\txsv_ext0 = xsb + 1;\n\t\t\t\t\tysv_ext0 = ysb - 1;\n\t\t\t\t\tzsv_ext0 = zsb + 1;\n\t\t\t\t} else {\n\t\t\t\t\tdx_ext0 = dx0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\tdy_ext0 = dy0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\tdz_ext0 = dz0 + 1 - SQUISH_CONSTANT_3D;\n\t\t\t\t\txsv_ext0 = xsb + 1;\n\t\t\t\t\tysv_ext0 = ysb + 1;\n\t\t\t\t\tzsv_ext0 = zsb - 1;\n\t\t\t\t}\n\n\t\t\t\t// One contribution is a permutation of (0,0,2)\n\t\t\t\tdx_ext1 = dx0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\tdy_ext1 = dy0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\tdz_ext1 = dz0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\t\txsv_ext1 = xsb;\n\t\t\t\tysv_ext1 = ysb;\n\t\t\t\tzsv_ext1 = zsb;\n\t\t\t\tif ((c2 & 0x01) != 0) {\n\t\t\t\t\tdx_ext1 -= 2;\n\t\t\t\t\txsv_ext1 += 2;\n\t\t\t\t} else if ((c2 & 0x02) != 0) {\n\t\t\t\t\tdy_ext1 -= 2;\n\t\t\t\t\tysv_ext1 += 2;\n\t\t\t\t} else {\n\t\t\t\t\tdz_ext1 -= 2;\n\t\t\t\t\tzsv_ext1 += 2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Contribution (1,0,0)\n\t\t\tdouble dx1 = dx0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\tdouble dy1 = dy0 - 0 - SQUISH_CONSTANT_3D;\n\t\t\tdouble dz1 = dz0 - 0 - SQUISH_CONSTANT_3D;\n\t\t\tdouble attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1;\n\t\t\tif (attn1 > 0) {\n\t\t\t\tattn1 *= attn1;\n\t\t\t\tvalue += attn1 * attn1 * extrapolate(xsb + 1, ysb + 0, zsb + 0, dx1, dy1, dz1);\n\t\t\t}\n\n\t\t\t// Contribution (0,1,0)\n\t\t\tdouble dx2 = dx0 - 0 - SQUISH_CONSTANT_3D;\n\t\t\tdouble dy2 = dy0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\tdouble dz2 = dz1;\n\t\t\tdouble attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2;\n\t\t\tif (attn2 > 0) {\n\t\t\t\tattn2 *= attn2;\n\t\t\t\tvalue += attn2 * attn2 * extrapolate(xsb + 0, ysb + 1, zsb + 0, dx2, dy2, dz2);\n\t\t\t}\n\n\t\t\t// Contribution (0,0,1)\n\t\t\tdouble dx3 = dx2;\n\t\t\tdouble dy3 = dy1;\n\t\t\tdouble dz3 = dz0 - 1 - SQUISH_CONSTANT_3D;\n\t\t\tdouble attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3;\n\t\t\tif (attn3 > 0) {\n\t\t\t\tattn3 *= attn3;\n\t\t\t\tvalue += attn3 * attn3 * extrapolate(xsb + 0, ysb + 0, zsb + 1, dx3, dy3, dz3);\n\t\t\t}\n\n\t\t\t// Contribution (1,1,0)\n\t\t\tdouble dx4 = dx0 - 1 - 2 * SQUISH_CONSTANT_3D;\n\t\t\tdouble dy4 = dy0 - 1 - 2 * SQUISH_CONSTANT_3D;\n\t\t\tdouble dz4 = dz0 - 0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\tdouble attn4 = 2 - dx4 * dx4 - dy4 * dy4 - dz4 * dz4;\n\t\t\tif (attn4 > 0) {\n\t\t\t\tattn4 *= attn4;\n\t\t\t\tvalue += attn4 * attn4 * extrapolate(xsb + 1, ysb + 1, zsb + 0, dx4, dy4, dz4);\n\t\t\t}\n\n\t\t\t// Contribution (1,0,1)\n\t\t\tdouble dx5 = dx4;\n\t\t\tdouble dy5 = dy0 - 0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\tdouble dz5 = dz0 - 1 - 2 * SQUISH_CONSTANT_3D;\n\t\t\tdouble attn5 = 2 - dx5 * dx5 - dy5 * dy5 - dz5 * dz5;\n\t\t\tif (attn5 > 0) {\n\t\t\t\tattn5 *= attn5;\n\t\t\t\tvalue += attn5 * attn5 * extrapolate(xsb + 1, ysb + 0, zsb + 1, dx5, dy5, dz5);\n\t\t\t}\n\n\t\t\t// Contribution (0,1,1)\n\t\t\tdouble dx6 = dx0 - 0 - 2 * SQUISH_CONSTANT_3D;\n\t\t\tdouble dy6 = dy4;\n\t\t\tdouble dz6 = dz5;\n\t\t\tdouble attn6 = 2 - dx6 * dx6 - dy6 * dy6 - dz6 * dz6;\n\t\t\tif (attn6 > 0) {\n\t\t\t\tattn6 *= attn6;\n\t\t\t\tvalue += attn6 * attn6 * extrapolate(xsb + 0, ysb + 1, zsb + 1, dx6, dy6, dz6);\n\t\t\t}\n\t\t}\n \n\t\t// First extra vertex\n\t\tdouble attn_ext0 = 2 - dx_ext0 * dx_ext0 - dy_ext0 * dy_ext0 - dz_ext0 * dz_ext0;\n\t\tif (attn_ext0 > 0)\n\t\t{\n\t\t\tattn_ext0 *= attn_ext0;\n\t\t\tvalue += attn_ext0 * attn_ext0 * extrapolate(xsv_ext0, ysv_ext0, zsv_ext0, dx_ext0, dy_ext0, dz_ext0);\n\t\t}\n\n\t\t// Second extra vertex\n\t\tdouble attn_ext1 = 2 - dx_ext1 * dx_ext1 - dy_ext1 * dy_ext1 - dz_ext1 * dz_ext1;\n\t\tif (attn_ext1 > 0)\n\t\t{\n\t\t\tattn_ext1 *= attn_ext1;\n\t\t\tvalue += attn_ext1 * attn_ext1 * extrapolate(xsv_ext1, ysv_ext1, zsv_ext1, dx_ext1, dy_ext1, dz_ext1);\n\t\t}\n\t\t\n\t\treturn value;\n\t}\n\t\n\tpublic double eval(double x, double y, double z, double w) {\n\t\t\n\t\t// Get points for A4 lattice\n\t\tdouble s = -0.138196601125011 * (x + y + z + w);\n\t\tdouble xs = x + s, ys = y + s, zs = z + s, ws = w + s;\n\t\t\n\t\treturn eval4_Base(xs, ys, zs, ws);\n\t}\n\t\n\tpublic double eval4_XYBeforeZW(double x, double y, double z, double w) {\n\t\t\n\t\tdouble s2 = (x + y) * -0.178275657951399372 + (z + w) * 0.215623393288842828;\n\t\tdouble t2 = (z + w) * -0.403949762580207112 + (x + y) * -0.375199083010075342;\n\t\tdouble xs = x + s2, ys = y + s2, zs = z + t2, ws = w + t2;\n\t\t\n\t\treturn eval4_Base(xs, ys, zs, ws);\n\t}\n\t\n\tpublic double eval4_XZBeforeYW(double x, double y, double z, double w) {\n\t\t\n\t\tdouble s2 = (x + z) * -0.178275657951399372 + (y + w) * 0.215623393288842828;\n\t\tdouble t2 = (y + w) * -0.403949762580207112 + (x + z) * -0.375199083010075342;\n\t\tdouble xs = x + s2, ys = y + t2, zs = z + s2, ws = w + t2;\n\t\t\n\t\treturn eval4_Base(xs, ys, zs, ws);\n\t}\n\t\n\tpublic double eval4_XYZBeforeW(double x, double y, double z, double w) {\n\t\t\n\t\tdouble xyz = x + y + z;\n\t\tdouble ww = w * 0.2236067977499788;\n\t\tdouble s2 = xyz * -0.16666666666666666 + ww;\n\t\tdouble xs = x + s2, ys = y + s2, zs = z + s2, ws = -0.5 * xyz + ww;\n\t\t\n\t\treturn eval4_Base(xs, ys, zs, ws);\n\t}\n\t\n\t// 4D OpenSimplex Noise.\n\tprivate double eval4_Base(double xs, double ys, double zs, double ws) {\n\t\t\n\t\t// Floor to get simplectic honeycomb coordinates of rhombo-hypercube super-cell origin.\n\t\tint xsb = fastFloor(xs);\n\t\tint ysb = fastFloor(ys);\n\t\tint zsb = fastFloor(zs);\n\t\tint wsb = fastFloor(ws);\n\t\t\n\t\t// Compute simplectic honeycomb coordinates relative to rhombo-hypercube origin.\n\t\tdouble xins = xs - xsb;\n\t\tdouble yins = ys - ysb;\n\t\tdouble zins = zs - zsb;\n\t\tdouble wins = ws - wsb;\n\t\t\n\t\t// Sum those together to get a value that determines which region we're in.\n\t\tdouble inSum = xins + yins + zins + wins;\n\n\t\t// Positions relative to origin point.\n\t\tdouble squishOffsetIns = inSum * SQUISH_CONSTANT_4D;\n\t\tdouble dx0 = xins + squishOffsetIns;\n\t\tdouble dy0 = yins + squishOffsetIns;\n\t\tdouble dz0 = zins + squishOffsetIns;\n\t\tdouble dw0 = wins + squishOffsetIns;\n\t\t\n\t\t// We'll be defining these inside the next block and using them afterwards.\n\t\tdouble dx_ext0, dy_ext0, dz_ext0, dw_ext0;\n\t\tdouble dx_ext1, dy_ext1, dz_ext1, dw_ext1;\n\t\tdouble dx_ext2, dy_ext2, dz_ext2, dw_ext2;\n\t\tint xsv_ext0, ysv_ext0, zsv_ext0, wsv_ext0;\n\t\tint xsv_ext1, ysv_ext1, zsv_ext1, wsv_ext1;\n\t\tint xsv_ext2, ysv_ext2, zsv_ext2, wsv_ext2;\n\t\t\n\t\tdouble value = 0;\n\t\tif (inSum <= 1) { // We're inside the pentachoron (4-Simplex) at (0,0,0,0)\n\n\t\t\t// Determine which two of (0,0,0,1), (0,0,1,0), (0,1,0,0), (1,0,0,0) are closest.\n\t\t\tbyte aPoint = 0x01;\n\t\t\tdouble aScore = xins;\n\t\t\tbyte bPoint = 0x02;\n\t\t\tdouble bScore = yins;\n\t\t\tif (aScore >= bScore && zins > bScore) {\n\t\t\t\tbScore = zins;\n\t\t\t\tbPoint = 0x04;\n\t\t\t} else if (aScore < bScore && zins > aScore) {\n\t\t\t\taScore = zins;\n\t\t\t\taPoint = 0x04;\n\t\t\t}\n\t\t\tif (aScore >= bScore && wins > bScore) {\n\t\t\t\tbScore = wins;\n\t\t\t\tbPoint = 0x08;\n\t\t\t} else if (aScore < bScore && wins > aScore) {\n\t\t\t\taScore = wins;\n\t\t\t\taPoint = 0x08;\n\t\t\t}\n\t\t\t\n\t\t\t// Now we determine the three lattice points not part of the pentachoron that may contribute.\n\t\t\t// This depends on the closest two pentachoron vertices, including (0,0,0,0)\n\t\t\tdouble uins = 1 - inSum;\n\t\t\tif (uins > aScore || uins > bScore) { // (0,0,0,0) is one of the closest two pentachoron vertices.\n\t\t\t\tbyte c = (bScore > aScore ? bPoint : aPoint); // Our other closest vertex is the closest out of a and b.\n\t\t\t\tif ((c & 0x01) == 0) {\n\t\t\t\t\txsv_ext0 = xsb - 1;\n\t\t\t\t\txsv_ext1 = xsv_ext2 = xsb;\n\t\t\t\t\tdx_ext0 = dx0 + 1;\n\t\t\t\t\tdx_ext1 = dx_ext2 = dx0;\n\t\t\t\t} else {\n\t\t\t\t\txsv_ext0 = xsv_ext1 = xsv_ext2 = xsb + 1;\n\t\t\t\t\tdx_ext0 = dx_ext1 = dx_ext2 = dx0 - 1;\n\t\t\t\t}\n\n\t\t\t\tif ((c & 0x02) == 0) {\n\t\t\t\t\tysv_ext0 = ysv_ext1 = ysv_ext2 = ysb;\n\t\t\t\t\tdy_ext0 = dy_ext1 = dy_ext2 = dy0;\n\t\t\t\t\tif ((c & 0x01) == 0x01) {\n\t\t\t\t\t\tysv_ext0 -= 1;\n\t\t\t\t\t\tdy_ext0 += 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tysv_ext1 -= 1;\n\t\t\t\t\t\tdy_ext1 += 1;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tysv_ext0 = ysv_ext1 = ysv_ext2 = ysb + 1;\n\t\t\t\t\tdy_ext0 = dy_ext1 = dy_ext2 = dy0 - 1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ((c & 0x04) == 0) {\n\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsv_ext2 = zsb;\n\t\t\t\t\tdz_ext0 = dz_ext1 = dz_ext2 = dz0;\n\t\t\t\t\tif ((c & 0x03) != 0) {\n\t\t\t\t\t\tif ((c & 0x03) == 0x03) {\n\t\t\t\t\t\t\tzsv_ext0 -= 1;\n\t\t\t\t\t\t\tdz_ext0 += 1;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tzsv_ext1 -= 1;\n\t\t\t\t\t\t\tdz_ext1 += 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzsv_ext2 -= 1;\n\t\t\t\t\t\tdz_ext2 += 1;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsv_ext2 = zsb + 1;\n\t\t\t\t\tdz_ext0 = dz_ext1 = dz_ext2 = dz0 - 1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ((c & 0x08) == 0) {\n\t\t\t\t\twsv_ext0 = wsv_ext1 = wsb;\n\t\t\t\t\twsv_ext2 = wsb - 1;\n\t\t\t\t\tdw_ext0 = dw_ext1 = dw0;\n\t\t\t\t\tdw_ext2 = dw0 + 1;\n\t\t\t\t} else {\n\t\t\t\t\twsv_ext0 = wsv_ext1 = wsv_ext2 = wsb + 1;\n\t\t\t\t\tdw_ext0 = dw_ext1 = dw_ext2 = dw0 - 1;\n\t\t\t\t}\n\t\t\t} else { // (0,0,0,0) is not one of the closest two pentachoron vertices.\n\t\t\t\tbyte c = (byte)(aPoint | bPoint); // Our three extra vertices are determined by the closest two.\n\t\t\t\t\n\t\t\t\tif ((c & 0x01) == 0) {\n\t\t\t\t\txsv_ext0 = xsv_ext2 = xsb;\n\t\t\t\t\txsv_ext1 = xsb - 1;\n\t\t\t\t\tdx_ext0 = dx0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdx_ext1 = dx0 + 1 - SQUISH_CONSTANT_4D;\n\t\t\t\t\tdx_ext2 = dx0 - SQUISH_CONSTANT_4D;\n\t\t\t\t} else {\n\t\t\t\t\txsv_ext0 = xsv_ext1 = xsv_ext2 = xsb + 1;\n\t\t\t\t\tdx_ext0 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdx_ext1 = dx_ext2 = dx0 - 1 - SQUISH_CONSTANT_4D;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ((c & 0x02) == 0) {\n\t\t\t\t\tysv_ext0 = ysv_ext1 = ysv_ext2 = ysb;\n\t\t\t\t\tdy_ext0 = dy0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdy_ext1 = dy_ext2 = dy0 - SQUISH_CONSTANT_4D;\n\t\t\t\t\tif ((c & 0x01) == 0x01) {\n\t\t\t\t\t\tysv_ext1 -= 1;\n\t\t\t\t\t\tdy_ext1 += 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tysv_ext2 -= 1;\n\t\t\t\t\t\tdy_ext2 += 1;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tysv_ext0 = ysv_ext1 = ysv_ext2 = ysb + 1;\n\t\t\t\t\tdy_ext0 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdy_ext1 = dy_ext2 = dy0 - 1 - SQUISH_CONSTANT_4D;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ((c & 0x04) == 0) {\n\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsv_ext2 = zsb;\n\t\t\t\t\tdz_ext0 = dz0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdz_ext1 = dz_ext2 = dz0 - SQUISH_CONSTANT_4D;\n\t\t\t\t\tif ((c & 0x03) == 0x03) {\n\t\t\t\t\t\tzsv_ext1 -= 1;\n\t\t\t\t\t\tdz_ext1 += 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzsv_ext2 -= 1;\n\t\t\t\t\t\tdz_ext2 += 1;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsv_ext2 = zsb + 1;\n\t\t\t\t\tdz_ext0 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdz_ext1 = dz_ext2 = dz0 - 1 - SQUISH_CONSTANT_4D;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ((c & 0x08) == 0) {\n\t\t\t\t\twsv_ext0 = wsv_ext1 = wsb;\n\t\t\t\t\twsv_ext2 = wsb - 1;\n\t\t\t\t\tdw_ext0 = dw0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdw_ext1 = dw0 - SQUISH_CONSTANT_4D;\n\t\t\t\t\tdw_ext2 = dw0 + 1 - SQUISH_CONSTANT_4D;\n\t\t\t\t} else {\n\t\t\t\t\twsv_ext0 = wsv_ext1 = wsv_ext2 = wsb + 1;\n\t\t\t\t\tdw_ext0 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdw_ext1 = dw_ext2 = dw0 - 1 - SQUISH_CONSTANT_4D;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Contribution (0,0,0,0)\n\t\t\tdouble attn0 = 2 - dx0 * dx0 - dy0 * dy0 - dz0 * dz0 - dw0 * dw0;\n\t\t\tif (attn0 > 0) {\n\t\t\t\tattn0 *= attn0;\n\t\t\t\tvalue += attn0 * attn0 * extrapolate(xsb + 0, ysb + 0, zsb + 0, wsb + 0, dx0, dy0, dz0, dw0);\n\t\t\t}\n\n\t\t\t// Contribution (1,0,0,0)\n\t\t\tdouble dx1 = dx0 - 1 - SQUISH_CONSTANT_4D;\n\t\t\tdouble dy1 = dy0 - 0 - SQUISH_CONSTANT_4D;\n\t\t\tdouble dz1 = dz0 - 0 - SQUISH_CONSTANT_4D;\n\t\t\tdouble dw1 = dw0 - 0 - SQUISH_CONSTANT_4D;\n\t\t\tdouble attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1 - dw1 * dw1;\n\t\t\tif (attn1 > 0) {\n\t\t\t\tattn1 *= attn1;\n\t\t\t\tvalue += attn1 * attn1 * extrapolate(xsb + 1, ysb + 0, zsb + 0, wsb + 0, dx1, dy1, dz1, dw1);\n\t\t\t}\n\n\t\t\t// Contribution (0,1,0,0)\n\t\t\tdouble dx2 = dx0 - 0 - SQUISH_CONSTANT_4D;\n\t\t\tdouble dy2 = dy0 - 1 - SQUISH_CONSTANT_4D;\n\t\t\tdouble dz2 = dz1;\n\t\t\tdouble dw2 = dw1;\n\t\t\tdouble attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2 - dw2 * dw2;\n\t\t\tif (attn2 > 0) {\n\t\t\t\tattn2 *= attn2;\n\t\t\t\tvalue += attn2 * attn2 * extrapolate(xsb + 0, ysb + 1, zsb + 0, wsb + 0, dx2, dy2, dz2, dw2);\n\t\t\t}\n\n\t\t\t// Contribution (0,0,1,0)\n\t\t\tdouble dx3 = dx2;\n\t\t\tdouble dy3 = dy1;\n\t\t\tdouble dz3 = dz0 - 1 - SQUISH_CONSTANT_4D;\n\t\t\tdouble dw3 = dw1;\n\t\t\tdouble attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3 - dw3 * dw3;\n\t\t\tif (attn3 > 0) {\n\t\t\t\tattn3 *= attn3;\n\t\t\t\tvalue += attn3 * attn3 * extrapolate(xsb + 0, ysb + 0, zsb + 1, wsb + 0, dx3, dy3, dz3, dw3);\n\t\t\t}\n\n\t\t\t// Contribution (0,0,0,1)\n\t\t\tdouble dx4 = dx2;\n\t\t\tdouble dy4 = dy1;\n\t\t\tdouble dz4 = dz1;\n\t\t\tdouble dw4 = dw0 - 1 - SQUISH_CONSTANT_4D;\n\t\t\tdouble attn4 = 2 - dx4 * dx4 - dy4 * dy4 - dz4 * dz4 - dw4 * dw4;\n\t\t\tif (attn4 > 0) {\n\t\t\t\tattn4 *= attn4;\n\t\t\t\tvalue += attn4 * attn4 * extrapolate(xsb + 0, ysb + 0, zsb + 0, wsb + 1, dx4, dy4, dz4, dw4);\n\t\t\t}\n\t\t} else if (inSum >= 3) { // We're inside the pentachoron (4-Simplex) at (1,1,1,1)\n\t\t\t// Determine which two of (1,1,1,0), (1,1,0,1), (1,0,1,1), (0,1,1,1) are closest.\n\t\t\tbyte aPoint = 0x0E;\n\t\t\tdouble aScore = xins;\n\t\t\tbyte bPoint = 0x0D;\n\t\t\tdouble bScore = yins;\n\t\t\tif (aScore <= bScore && zins < bScore) {\n\t\t\t\tbScore = zins;\n\t\t\t\tbPoint = 0x0B;\n\t\t\t} else if (aScore > bScore && zins < aScore) {\n\t\t\t\taScore = zins;\n\t\t\t\taPoint = 0x0B;\n\t\t\t}\n\t\t\tif (aScore <= bScore && wins < bScore) {\n\t\t\t\tbScore = wins;\n\t\t\t\tbPoint = 0x07;\n\t\t\t} else if (aScore > bScore && wins < aScore) {\n\t\t\t\taScore = wins;\n\t\t\t\taPoint = 0x07;\n\t\t\t}\n\t\t\t\n\t\t\t// Now we determine the three lattice points not part of the pentachoron that may contribute.\n\t\t\t// This depends on the closest two pentachoron vertices, including (0,0,0,0)\n\t\t\tdouble uins = 4 - inSum;\n\t\t\tif (uins < aScore || uins < bScore) { // (1,1,1,1) is one of the closest two pentachoron vertices.\n\t\t\t\tbyte c = (bScore < aScore ? bPoint : aPoint); // Our other closest vertex is the closest out of a and b.\n\t\t\t\t\n\t\t\t\tif ((c & 0x01) != 0) {\n\t\t\t\t\txsv_ext0 = xsb + 2;\n\t\t\t\t\txsv_ext1 = xsv_ext2 = xsb + 1;\n\t\t\t\t\tdx_ext0 = dx0 - 2 - 4 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdx_ext1 = dx_ext2 = dx0 - 1 - 4 * SQUISH_CONSTANT_4D;\n\t\t\t\t} else {\n\t\t\t\t\txsv_ext0 = xsv_ext1 = xsv_ext2 = xsb;\n\t\t\t\t\tdx_ext0 = dx_ext1 = dx_ext2 = dx0 - 4 * SQUISH_CONSTANT_4D;\n\t\t\t\t}\n\n\t\t\t\tif ((c & 0x02) != 0) {\n\t\t\t\t\tysv_ext0 = ysv_ext1 = ysv_ext2 = ysb + 1;\n\t\t\t\t\tdy_ext0 = dy_ext1 = dy_ext2 = dy0 - 1 - 4 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tif ((c & 0x01) != 0) {\n\t\t\t\t\t\tysv_ext1 += 1;\n\t\t\t\t\t\tdy_ext1 -= 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tysv_ext0 += 1;\n\t\t\t\t\t\tdy_ext0 -= 1;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tysv_ext0 = ysv_ext1 = ysv_ext2 = ysb;\n\t\t\t\t\tdy_ext0 = dy_ext1 = dy_ext2 = dy0 - 4 * SQUISH_CONSTANT_4D;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ((c & 0x04) != 0) {\n\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsv_ext2 = zsb + 1;\n\t\t\t\t\tdz_ext0 = dz_ext1 = dz_ext2 = dz0 - 1 - 4 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tif ((c & 0x03) != 0x03) {\n\t\t\t\t\t\tif ((c & 0x03) == 0) {\n\t\t\t\t\t\t\tzsv_ext0 += 1;\n\t\t\t\t\t\t\tdz_ext0 -= 1;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tzsv_ext1 += 1;\n\t\t\t\t\t\t\tdz_ext1 -= 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzsv_ext2 += 1;\n\t\t\t\t\t\tdz_ext2 -= 1;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsv_ext2 = zsb;\n\t\t\t\t\tdz_ext0 = dz_ext1 = dz_ext2 = dz0 - 4 * SQUISH_CONSTANT_4D;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ((c & 0x08) != 0) {\n\t\t\t\t\twsv_ext0 = wsv_ext1 = wsb + 1;\n\t\t\t\t\twsv_ext2 = wsb + 2;\n\t\t\t\t\tdw_ext0 = dw_ext1 = dw0 - 1 - 4 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdw_ext2 = dw0 - 2 - 4 * SQUISH_CONSTANT_4D;\n\t\t\t\t} else {\n\t\t\t\t\twsv_ext0 = wsv_ext1 = wsv_ext2 = wsb;\n\t\t\t\t\tdw_ext0 = dw_ext1 = dw_ext2 = dw0 - 4 * SQUISH_CONSTANT_4D;\n\t\t\t\t}\n\t\t\t} else { // (1,1,1,1) is not one of the closest two pentachoron vertices.\n\t\t\t\tbyte c = (byte)(aPoint & bPoint); // Our three extra vertices are determined by the closest two.\n\t\t\t\t\n\t\t\t\tif ((c & 0x01) != 0) {\n\t\t\t\t\txsv_ext0 = xsv_ext2 = xsb + 1;\n\t\t\t\t\txsv_ext1 = xsb + 2;\n\t\t\t\t\tdx_ext0 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdx_ext1 = dx0 - 2 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdx_ext2 = dx0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t} else {\n\t\t\t\t\txsv_ext0 = xsv_ext1 = xsv_ext2 = xsb;\n\t\t\t\t\tdx_ext0 = dx0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdx_ext1 = dx_ext2 = dx0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ((c & 0x02) != 0) {\n\t\t\t\t\tysv_ext0 = ysv_ext1 = ysv_ext2 = ysb + 1;\n\t\t\t\t\tdy_ext0 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdy_ext1 = dy_ext2 = dy0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tif ((c & 0x01) != 0) {\n\t\t\t\t\t\tysv_ext2 += 1;\n\t\t\t\t\t\tdy_ext2 -= 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tysv_ext1 += 1;\n\t\t\t\t\t\tdy_ext1 -= 1;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tysv_ext0 = ysv_ext1 = ysv_ext2 = ysb;\n\t\t\t\t\tdy_ext0 = dy0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdy_ext1 = dy_ext2 = dy0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ((c & 0x04) != 0) {\n\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsv_ext2 = zsb + 1;\n\t\t\t\t\tdz_ext0 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdz_ext1 = dz_ext2 = dz0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tif ((c & 0x03) != 0) {\n\t\t\t\t\t\tzsv_ext2 += 1;\n\t\t\t\t\t\tdz_ext2 -= 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzsv_ext1 += 1;\n\t\t\t\t\t\tdz_ext1 -= 1;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsv_ext2 = zsb;\n\t\t\t\t\tdz_ext0 = dz0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdz_ext1 = dz_ext2 = dz0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ((c & 0x08) != 0) {\n\t\t\t\t\twsv_ext0 = wsv_ext1 = wsb + 1;\n\t\t\t\t\twsv_ext2 = wsb + 2;\n\t\t\t\t\tdw_ext0 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdw_ext1 = dw0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdw_ext2 = dw0 - 2 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t} else {\n\t\t\t\t\twsv_ext0 = wsv_ext1 = wsv_ext2 = wsb;\n\t\t\t\t\tdw_ext0 = dw0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdw_ext1 = dw_ext2 = dw0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Contribution (1,1,1,0)\n\t\t\tdouble dx4 = dx0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dy4 = dy0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dz4 = dz0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dw4 = dw0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\tdouble attn4 = 2 - dx4 * dx4 - dy4 * dy4 - dz4 * dz4 - dw4 * dw4;\n\t\t\tif (attn4 > 0) {\n\t\t\t\tattn4 *= attn4;\n\t\t\t\tvalue += attn4 * attn4 * extrapolate(xsb + 1, ysb + 1, zsb + 1, wsb + 0, dx4, dy4, dz4, dw4);\n\t\t\t}\n\n\t\t\t// Contribution (1,1,0,1)\n\t\t\tdouble dx3 = dx4;\n\t\t\tdouble dy3 = dy4;\n\t\t\tdouble dz3 = dz0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dw3 = dw0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\tdouble attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3 - dw3 * dw3;\n\t\t\tif (attn3 > 0) {\n\t\t\t\tattn3 *= attn3;\n\t\t\t\tvalue += attn3 * attn3 * extrapolate(xsb + 1, ysb + 1, zsb + 0, wsb + 1, dx3, dy3, dz3, dw3);\n\t\t\t}\n\n\t\t\t// Contribution (1,0,1,1)\n\t\t\tdouble dx2 = dx4;\n\t\t\tdouble dy2 = dy0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dz2 = dz4;\n\t\t\tdouble dw2 = dw3;\n\t\t\tdouble attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2 - dw2 * dw2;\n\t\t\tif (attn2 > 0) {\n\t\t\t\tattn2 *= attn2;\n\t\t\t\tvalue += attn2 * attn2 * extrapolate(xsb + 1, ysb + 0, zsb + 1, wsb + 1, dx2, dy2, dz2, dw2);\n\t\t\t}\n\n\t\t\t// Contribution (0,1,1,1)\n\t\t\tdouble dx1 = dx0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dz1 = dz4;\n\t\t\tdouble dy1 = dy4;\n\t\t\tdouble dw1 = dw3;\n\t\t\tdouble attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1 - dw1 * dw1;\n\t\t\tif (attn1 > 0) {\n\t\t\t\tattn1 *= attn1;\n\t\t\t\tvalue += attn1 * attn1 * extrapolate(xsb + 0, ysb + 1, zsb + 1, wsb + 1, dx1, dy1, dz1, dw1);\n\t\t\t}\n\n\t\t\t// Contribution (1,1,1,1)\n\t\t\tdx0 = dx0 - 1 - 4 * SQUISH_CONSTANT_4D;\n\t\t\tdy0 = dy0 - 1 - 4 * SQUISH_CONSTANT_4D;\n\t\t\tdz0 = dz0 - 1 - 4 * SQUISH_CONSTANT_4D;\n\t\t\tdw0 = dw0 - 1 - 4 * SQUISH_CONSTANT_4D;\n\t\t\tdouble attn0 = 2 - dx0 * dx0 - dy0 * dy0 - dz0 * dz0 - dw0 * dw0;\n\t\t\tif (attn0 > 0) {\n\t\t\t\tattn0 *= attn0;\n\t\t\t\tvalue += attn0 * attn0 * extrapolate(xsb + 1, ysb + 1, zsb + 1, wsb + 1, dx0, dy0, dz0, dw0);\n\t\t\t}\n\t\t} else if (inSum <= 2) { // We're inside the first dispentachoron (Rectified 4-Simplex)\n\t\t\tdouble aScore;\n\t\t\tbyte aPoint;\n\t\t\tboolean aIsBiggerSide = true;\n\t\t\tdouble bScore;\n\t\t\tbyte bPoint;\n\t\t\tboolean bIsBiggerSide = true;\n\t\t\t\n\t\t\t// Decide between (1,1,0,0) and (0,0,1,1)\n\t\t\tif (xins + yins > zins + wins) {\n\t\t\t\taScore = xins + yins;\n\t\t\t\taPoint = 0x03;\n\t\t\t} else {\n\t\t\t\taScore = zins + wins;\n\t\t\t\taPoint = 0x0C;\n\t\t\t}\n\t\t\t\n\t\t\t// Decide between (1,0,1,0) and (0,1,0,1)\n\t\t\tif (xins + zins > yins + wins) {\n\t\t\t\tbScore = xins + zins;\n\t\t\t\tbPoint = 0x05;\n\t\t\t} else {\n\t\t\t\tbScore = yins + wins;\n\t\t\t\tbPoint = 0x0A;\n\t\t\t}\n\t\t\t\n\t\t\t// Closer between (1,0,0,1) and (0,1,1,0) will replace the further of a and b, if closer.\n\t\t\tif (xins + wins > yins + zins) {\n\t\t\t\tdouble score = xins + wins;\n\t\t\t\tif (aScore >= bScore && score > bScore) {\n\t\t\t\t\tbScore = score;\n\t\t\t\t\tbPoint = 0x09;\n\t\t\t\t} else if (aScore < bScore && score > aScore) {\n\t\t\t\t\taScore = score;\n\t\t\t\t\taPoint = 0x09;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdouble score = yins + zins;\n\t\t\t\tif (aScore >= bScore && score > bScore) {\n\t\t\t\t\tbScore = score;\n\t\t\t\t\tbPoint = 0x06;\n\t\t\t\t} else if (aScore < bScore && score > aScore) {\n\t\t\t\t\taScore = score;\n\t\t\t\t\taPoint = 0x06;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// Decide if (1,0,0,0) is closer.\n\t\t\tdouble p1 = 2 - inSum + xins;\n\t\t\tif (aScore >= bScore && p1 > bScore) {\n\t\t\t\tbScore = p1;\n\t\t\t\tbPoint = 0x01;\n\t\t\t\tbIsBiggerSide = false;\n\t\t\t} else if (aScore < bScore && p1 > aScore) {\n\t\t\t\taScore = p1;\n\t\t\t\taPoint = 0x01;\n\t\t\t\taIsBiggerSide = false;\n\t\t\t}\n\t\t\t\n\t\t\t// Decide if (0,1,0,0) is closer.\n\t\t\tdouble p2 = 2 - inSum + yins;\n\t\t\tif (aScore >= bScore && p2 > bScore) {\n\t\t\t\tbScore = p2;\n\t\t\t\tbPoint = 0x02;\n\t\t\t\tbIsBiggerSide = false;\n\t\t\t} else if (aScore < bScore && p2 > aScore) {\n\t\t\t\taScore = p2;\n\t\t\t\taPoint = 0x02;\n\t\t\t\taIsBiggerSide = false;\n\t\t\t}\n\t\t\t\n\t\t\t// Decide if (0,0,1,0) is closer.\n\t\t\tdouble p3 = 2 - inSum + zins;\n\t\t\tif (aScore >= bScore && p3 > bScore) {\n\t\t\t\tbScore = p3;\n\t\t\t\tbPoint = 0x04;\n\t\t\t\tbIsBiggerSide = false;\n\t\t\t} else if (aScore < bScore && p3 > aScore) {\n\t\t\t\taScore = p3;\n\t\t\t\taPoint = 0x04;\n\t\t\t\taIsBiggerSide = false;\n\t\t\t}\n\t\t\t\n\t\t\t// Decide if (0,0,0,1) is closer.\n\t\t\tdouble p4 = 2 - inSum + wins;\n\t\t\tif (aScore >= bScore && p4 > bScore) {\n\t\t\t\tbScore = p4;\n\t\t\t\tbPoint = 0x08;\n\t\t\t\tbIsBiggerSide = false;\n\t\t\t} else if (aScore < bScore && p4 > aScore) {\n\t\t\t\taScore = p4;\n\t\t\t\taPoint = 0x08;\n\t\t\t\taIsBiggerSide = false;\n\t\t\t}\n\t\t\t\n\t\t\t// Where each of the two closest points are determines how the extra three vertices are calculated.\n\t\t\tif (aIsBiggerSide == bIsBiggerSide) {\n\t\t\t\tif (aIsBiggerSide) { // Both closest points on the bigger side\n\t\t\t\t\tbyte c1 = (byte)(aPoint | bPoint);\n\t\t\t\t\tbyte c2 = (byte)(aPoint & bPoint);\n\t\t\t\t\tif ((c1 & 0x01) == 0) {\n\t\t\t\t\t\txsv_ext0 = xsb;\n\t\t\t\t\t\txsv_ext1 = xsb - 1;\n\t\t\t\t\t\tdx_ext0 = dx0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t\tdx_ext1 = dx0 + 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t} else {\n\t\t\t\t\t\txsv_ext0 = xsv_ext1 = xsb + 1;\n\t\t\t\t\t\tdx_ext0 = dx0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t\tdx_ext1 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ((c1 & 0x02) == 0) {\n\t\t\t\t\t\tysv_ext0 = ysb;\n\t\t\t\t\t\tysv_ext1 = ysb - 1;\n\t\t\t\t\t\tdy_ext0 = dy0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t\tdy_ext1 = dy0 + 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tysv_ext0 = ysv_ext1 = ysb + 1;\n\t\t\t\t\t\tdy_ext0 = dy0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t\tdy_ext1 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ((c1 & 0x04) == 0) {\n\t\t\t\t\t\tzsv_ext0 = zsb;\n\t\t\t\t\t\tzsv_ext1 = zsb - 1;\n\t\t\t\t\t\tdz_ext0 = dz0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t\tdz_ext1 = dz0 + 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsb + 1;\n\t\t\t\t\t\tdz_ext0 = dz0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t\tdz_ext1 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ((c1 & 0x08) == 0) {\n\t\t\t\t\t\twsv_ext0 = wsb;\n\t\t\t\t\t\twsv_ext1 = wsb - 1;\n\t\t\t\t\t\tdw_ext0 = dw0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t\tdw_ext1 = dw0 + 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t} else {\n\t\t\t\t\t\twsv_ext0 = wsv_ext1 = wsb + 1;\n\t\t\t\t\t\tdw_ext0 = dw0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t\tdw_ext1 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// One combination is a permutation of (0,0,0,2) based on c2\n\t\t\t\t\txsv_ext2 = xsb;\n\t\t\t\t\tysv_ext2 = ysb;\n\t\t\t\t\tzsv_ext2 = zsb;\n\t\t\t\t\twsv_ext2 = wsb;\n\t\t\t\t\tdx_ext2 = dx0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdy_ext2 = dy0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdz_ext2 = dz0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdw_ext2 = dw0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tif ((c2 & 0x01) != 0) {\n\t\t\t\t\t\txsv_ext2 += 2;\n\t\t\t\t\t\tdx_ext2 -= 2;\n\t\t\t\t\t} else if ((c2 & 0x02) != 0) {\n\t\t\t\t\t\tysv_ext2 += 2;\n\t\t\t\t\t\tdy_ext2 -= 2;\n\t\t\t\t\t} else if ((c2 & 0x04) != 0) {\n\t\t\t\t\t\tzsv_ext2 += 2;\n\t\t\t\t\t\tdz_ext2 -= 2;\n\t\t\t\t\t} else {\n\t\t\t\t\t\twsv_ext2 += 2;\n\t\t\t\t\t\tdw_ext2 -= 2;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t} else { // Both closest points on the smaller side\n\t\t\t\t\t// One of the two extra points is (0,0,0,0)\n\t\t\t\t\txsv_ext2 = xsb;\n\t\t\t\t\tysv_ext2 = ysb;\n\t\t\t\t\tzsv_ext2 = zsb;\n\t\t\t\t\twsv_ext2 = wsb;\n\t\t\t\t\tdx_ext2 = dx0;\n\t\t\t\t\tdy_ext2 = dy0;\n\t\t\t\t\tdz_ext2 = dz0;\n\t\t\t\t\tdw_ext2 = dw0;\n\t\t\t\t\t\n\t\t\t\t\t// Other two points are based on the omitted axes.\n\t\t\t\t\tbyte c = (byte)(aPoint | bPoint);\n\t\t\t\t\t\n\t\t\t\t\tif ((c & 0x01) == 0) {\n\t\t\t\t\t\txsv_ext0 = xsb - 1;\n\t\t\t\t\t\txsv_ext1 = xsb;\n\t\t\t\t\t\tdx_ext0 = dx0 + 1 - SQUISH_CONSTANT_4D;\n\t\t\t\t\t\tdx_ext1 = dx0 - SQUISH_CONSTANT_4D;\n\t\t\t\t\t} else {\n\t\t\t\t\t\txsv_ext0 = xsv_ext1 = xsb + 1;\n\t\t\t\t\t\tdx_ext0 = dx_ext1 = dx0 - 1 - SQUISH_CONSTANT_4D;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ((c & 0x02) == 0) {\n\t\t\t\t\t\tysv_ext0 = ysv_ext1 = ysb;\n\t\t\t\t\t\tdy_ext0 = dy_ext1 = dy0 - SQUISH_CONSTANT_4D;\n\t\t\t\t\t\tif ((c & 0x01) == 0x01)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tysv_ext0 -= 1;\n\t\t\t\t\t\t\tdy_ext0 += 1;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tysv_ext1 -= 1;\n\t\t\t\t\t\t\tdy_ext1 += 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tysv_ext0 = ysv_ext1 = ysb + 1;\n\t\t\t\t\t\tdy_ext0 = dy_ext1 = dy0 - 1 - SQUISH_CONSTANT_4D;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ((c & 0x04) == 0) {\n\t\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsb;\n\t\t\t\t\t\tdz_ext0 = dz_ext1 = dz0 - SQUISH_CONSTANT_4D;\n\t\t\t\t\t\tif ((c & 0x03) == 0x03)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tzsv_ext0 -= 1;\n\t\t\t\t\t\t\tdz_ext0 += 1;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tzsv_ext1 -= 1;\n\t\t\t\t\t\t\tdz_ext1 += 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsb + 1;\n\t\t\t\t\t\tdz_ext0 = dz_ext1 = dz0 - 1 - SQUISH_CONSTANT_4D;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ((c & 0x08) == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\twsv_ext0 = wsb;\n\t\t\t\t\t\twsv_ext1 = wsb - 1;\n\t\t\t\t\t\tdw_ext0 = dw0 - SQUISH_CONSTANT_4D;\n\t\t\t\t\t\tdw_ext1 = dw0 + 1 - SQUISH_CONSTANT_4D;\n\t\t\t\t\t} else {\n\t\t\t\t\t\twsv_ext0 = wsv_ext1 = wsb + 1;\n\t\t\t\t\t\tdw_ext0 = dw_ext1 = dw0 - 1 - SQUISH_CONSTANT_4D;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t} else { // One point on each \"side\"\n\t\t\t\tbyte c1, c2;\n\t\t\t\tif (aIsBiggerSide) {\n\t\t\t\t\tc1 = aPoint;\n\t\t\t\t\tc2 = bPoint;\n\t\t\t\t} else {\n\t\t\t\t\tc1 = bPoint;\n\t\t\t\t\tc2 = aPoint;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Two contributions are the bigger-sided point with each 0 replaced with -1.\n\t\t\t\tif ((c1 & 0x01) == 0) {\n\t\t\t\t\txsv_ext0 = xsb - 1;\n\t\t\t\t\txsv_ext1 = xsb;\n\t\t\t\t\tdx_ext0 = dx0 + 1 - SQUISH_CONSTANT_4D;\n\t\t\t\t\tdx_ext1 = dx0 - SQUISH_CONSTANT_4D;\n\t\t\t\t} else {\n\t\t\t\t\txsv_ext0 = xsv_ext1 = xsb + 1;\n\t\t\t\t\tdx_ext0 = dx_ext1 = dx0 - 1 - SQUISH_CONSTANT_4D;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ((c1 & 0x02) == 0) {\n\t\t\t\t\tysv_ext0 = ysv_ext1 = ysb;\n\t\t\t\t\tdy_ext0 = dy_ext1 = dy0 - SQUISH_CONSTANT_4D;\n\t\t\t\t\tif ((c1 & 0x01) == 0x01) {\n\t\t\t\t\t\tysv_ext0 -= 1;\n\t\t\t\t\t\tdy_ext0 += 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tysv_ext1 -= 1;\n\t\t\t\t\t\tdy_ext1 += 1;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tysv_ext0 = ysv_ext1 = ysb + 1;\n\t\t\t\t\tdy_ext0 = dy_ext1 = dy0 - 1 - SQUISH_CONSTANT_4D;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ((c1 & 0x04) == 0) {\n\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsb;\n\t\t\t\t\tdz_ext0 = dz_ext1 = dz0 - SQUISH_CONSTANT_4D;\n\t\t\t\t\tif ((c1 & 0x03) == 0x03) {\n\t\t\t\t\t\tzsv_ext0 -= 1;\n\t\t\t\t\t\tdz_ext0 += 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzsv_ext1 -= 1;\n\t\t\t\t\t\tdz_ext1 += 1;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsb + 1;\n\t\t\t\t\tdz_ext0 = dz_ext1 = dz0 - 1 - SQUISH_CONSTANT_4D;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ((c1 & 0x08) == 0) {\n\t\t\t\t\twsv_ext0 = wsb;\n\t\t\t\t\twsv_ext1 = wsb - 1;\n\t\t\t\t\tdw_ext0 = dw0 - SQUISH_CONSTANT_4D;\n\t\t\t\t\tdw_ext1 = dw0 + 1 - SQUISH_CONSTANT_4D;\n\t\t\t\t} else {\n\t\t\t\t\twsv_ext0 = wsv_ext1 = wsb + 1;\n\t\t\t\t\tdw_ext0 = dw_ext1 = dw0 - 1 - SQUISH_CONSTANT_4D;\n\t\t\t\t}\n\n\t\t\t\t// One contribution is a permutation of (0,0,0,2) based on the smaller-sided point\n\t\t\t\txsv_ext2 = xsb;\n\t\t\t\tysv_ext2 = ysb;\n\t\t\t\tzsv_ext2 = zsb;\n\t\t\t\twsv_ext2 = wsb;\n\t\t\t\tdx_ext2 = dx0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\tdy_ext2 = dy0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\tdz_ext2 = dz0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\tdw_ext2 = dw0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\tif ((c2 & 0x01) != 0) {\n\t\t\t\t\txsv_ext2 += 2;\n\t\t\t\t\tdx_ext2 -= 2;\n\t\t\t\t} else if ((c2 & 0x02) != 0) {\n\t\t\t\t\tysv_ext2 += 2;\n\t\t\t\t\tdy_ext2 -= 2;\n\t\t\t\t} else if ((c2 & 0x04) != 0) {\n\t\t\t\t\tzsv_ext2 += 2;\n\t\t\t\t\tdz_ext2 -= 2;\n\t\t\t\t} else {\n\t\t\t\t\twsv_ext2 += 2;\n\t\t\t\t\tdw_ext2 -= 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// Contribution (1,0,0,0)\n\t\t\tdouble dx1 = dx0 - 1 - SQUISH_CONSTANT_4D;\n\t\t\tdouble dy1 = dy0 - 0 - SQUISH_CONSTANT_4D;\n\t\t\tdouble dz1 = dz0 - 0 - SQUISH_CONSTANT_4D;\n\t\t\tdouble dw1 = dw0 - 0 - SQUISH_CONSTANT_4D;\n\t\t\tdouble attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1 - dw1 * dw1;\n\t\t\tif (attn1 > 0) {\n\t\t\t\tattn1 *= attn1;\n\t\t\t\tvalue += attn1 * attn1 * extrapolate(xsb + 1, ysb + 0, zsb + 0, wsb + 0, dx1, dy1, dz1, dw1);\n\t\t\t}\n\n\t\t\t// Contribution (0,1,0,0)\n\t\t\tdouble dx2 = dx0 - 0 - SQUISH_CONSTANT_4D;\n\t\t\tdouble dy2 = dy0 - 1 - SQUISH_CONSTANT_4D;\n\t\t\tdouble dz2 = dz1;\n\t\t\tdouble dw2 = dw1;\n\t\t\tdouble attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2 - dw2 * dw2;\n\t\t\tif (attn2 > 0) {\n\t\t\t\tattn2 *= attn2;\n\t\t\t\tvalue += attn2 * attn2 * extrapolate(xsb + 0, ysb + 1, zsb + 0, wsb + 0, dx2, dy2, dz2, dw2);\n\t\t\t}\n\n\t\t\t// Contribution (0,0,1,0)\n\t\t\tdouble dx3 = dx2;\n\t\t\tdouble dy3 = dy1;\n\t\t\tdouble dz3 = dz0 - 1 - SQUISH_CONSTANT_4D;\n\t\t\tdouble dw3 = dw1;\n\t\t\tdouble attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3 - dw3 * dw3;\n\t\t\tif (attn3 > 0) {\n\t\t\t\tattn3 *= attn3;\n\t\t\t\tvalue += attn3 * attn3 * extrapolate(xsb + 0, ysb + 0, zsb + 1, wsb + 0, dx3, dy3, dz3, dw3);\n\t\t\t}\n\n\t\t\t// Contribution (0,0,0,1)\n\t\t\tdouble dx4 = dx2;\n\t\t\tdouble dy4 = dy1;\n\t\t\tdouble dz4 = dz1;\n\t\t\tdouble dw4 = dw0 - 1 - SQUISH_CONSTANT_4D;\n\t\t\tdouble attn4 = 2 - dx4 * dx4 - dy4 * dy4 - dz4 * dz4 - dw4 * dw4;\n\t\t\tif (attn4 > 0) {\n\t\t\t\tattn4 *= attn4;\n\t\t\t\tvalue += attn4 * attn4 * extrapolate(xsb + 0, ysb + 0, zsb + 0, wsb + 1, dx4, dy4, dz4, dw4);\n\t\t\t}\n\t\t\t\n\t\t\t// Contribution (1,1,0,0)\n\t\t\tdouble dx5 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dy5 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dz5 = dz0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dw5 = dw0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble attn5 = 2 - dx5 * dx5 - dy5 * dy5 - dz5 * dz5 - dw5 * dw5;\n\t\t\tif (attn5 > 0) {\n\t\t\t\tattn5 *= attn5;\n\t\t\t\tvalue += attn5 * attn5 * extrapolate(xsb + 1, ysb + 1, zsb + 0, wsb + 0, dx5, dy5, dz5, dw5);\n\t\t\t}\n\t\t\t\n\t\t\t// Contribution (1,0,1,0)\n\t\t\tdouble dx6 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dy6 = dy0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dz6 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dw6 = dw0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble attn6 = 2 - dx6 * dx6 - dy6 * dy6 - dz6 * dz6 - dw6 * dw6;\n\t\t\tif (attn6 > 0) {\n\t\t\t\tattn6 *= attn6;\n\t\t\t\tvalue += attn6 * attn6 * extrapolate(xsb + 1, ysb + 0, zsb + 1, wsb + 0, dx6, dy6, dz6, dw6);\n\t\t\t}\n\n\t\t\t// Contribution (1,0,0,1)\n\t\t\tdouble dx7 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dy7 = dy0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dz7 = dz0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dw7 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble attn7 = 2 - dx7 * dx7 - dy7 * dy7 - dz7 * dz7 - dw7 * dw7;\n\t\t\tif (attn7 > 0) {\n\t\t\t\tattn7 *= attn7;\n\t\t\t\tvalue += attn7 * attn7 * extrapolate(xsb + 1, ysb + 0, zsb + 0, wsb + 1, dx7, dy7, dz7, dw7);\n\t\t\t}\n\t\t\t\n\t\t\t// Contribution (0,1,1,0)\n\t\t\tdouble dx8 = dx0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dy8 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dz8 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dw8 = dw0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble attn8 = 2 - dx8 * dx8 - dy8 * dy8 - dz8 * dz8 - dw8 * dw8;\n\t\t\tif (attn8 > 0) {\n\t\t\t\tattn8 *= attn8;\n\t\t\t\tvalue += attn8 * attn8 * extrapolate(xsb + 0, ysb + 1, zsb + 1, wsb + 0, dx8, dy8, dz8, dw8);\n\t\t\t}\n\t\t\t\n\t\t\t// Contribution (0,1,0,1)\n\t\t\tdouble dx9 = dx0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dy9 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dz9 = dz0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dw9 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble attn9 = 2 - dx9 * dx9 - dy9 * dy9 - dz9 * dz9 - dw9 * dw9;\n\t\t\tif (attn9 > 0) {\n\t\t\t\tattn9 *= attn9;\n\t\t\t\tvalue += attn9 * attn9 * extrapolate(xsb + 0, ysb + 1, zsb + 0, wsb + 1, dx9, dy9, dz9, dw9);\n\t\t\t}\n\t\t\t\n\t\t\t// Contribution (0,0,1,1)\n\t\t\tdouble dx10 = dx0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dy10 = dy0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dz10 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dw10 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble attn10 = 2 - dx10 * dx10 - dy10 * dy10 - dz10 * dz10 - dw10 * dw10;\n\t\t\tif (attn10 > 0) {\n\t\t\t\tattn10 *= attn10;\n\t\t\t\tvalue += attn10 * attn10 * extrapolate(xsb + 0, ysb + 0, zsb + 1, wsb + 1, dx10, dy10, dz10, dw10);\n\t\t\t}\n\t\t} else { // We're inside the second dispentachoron (Rectified 4-Simplex)\n\t\t\tdouble aScore;\n\t\t\tbyte aPoint;\n\t\t\tboolean aIsBiggerSide = true;\n\t\t\tdouble bScore;\n\t\t\tbyte bPoint;\n\t\t\tboolean bIsBiggerSide = true;\n\t\t\t\n\t\t\t// Decide between (0,0,1,1) and (1,1,0,0)\n\t\t\tif (xins + yins < zins + wins) {\n\t\t\t\taScore = xins + yins;\n\t\t\t\taPoint = 0x0C;\n\t\t\t} else {\n\t\t\t\taScore = zins + wins;\n\t\t\t\taPoint = 0x03;\n\t\t\t}\n\t\t\t\n\t\t\t// Decide between (0,1,0,1) and (1,0,1,0)\n\t\t\tif (xins + zins < yins + wins) {\n\t\t\t\tbScore = xins + zins;\n\t\t\t\tbPoint = 0x0A;\n\t\t\t} else {\n\t\t\t\tbScore = yins + wins;\n\t\t\t\tbPoint = 0x05;\n\t\t\t}\n\t\t\t\n\t\t\t// Closer between (0,1,1,0) and (1,0,0,1) will replace the further of a and b, if closer.\n\t\t\tif (xins + wins < yins + zins) {\n\t\t\t\tdouble score = xins + wins;\n\t\t\t\tif (aScore <= bScore && score < bScore) {\n\t\t\t\t\tbScore = score;\n\t\t\t\t\tbPoint = 0x06;\n\t\t\t\t} else if (aScore > bScore && score < aScore) {\n\t\t\t\t\taScore = score;\n\t\t\t\t\taPoint = 0x06;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdouble score = yins + zins;\n\t\t\t\tif (aScore <= bScore && score < bScore) {\n\t\t\t\t\tbScore = score;\n\t\t\t\t\tbPoint = 0x09;\n\t\t\t\t} else if (aScore > bScore && score < aScore) {\n\t\t\t\t\taScore = score;\n\t\t\t\t\taPoint = 0x09;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// Decide if (0,1,1,1) is closer.\n\t\t\tdouble p1 = 3 - inSum + xins;\n\t\t\tif (aScore <= bScore && p1 < bScore) {\n\t\t\t\tbScore = p1;\n\t\t\t\tbPoint = 0x0E;\n\t\t\t\tbIsBiggerSide = false;\n\t\t\t} else if (aScore > bScore && p1 < aScore) {\n\t\t\t\taScore = p1;\n\t\t\t\taPoint = 0x0E;\n\t\t\t\taIsBiggerSide = false;\n\t\t\t}\n\t\t\t\n\t\t\t// Decide if (1,0,1,1) is closer.\n\t\t\tdouble p2 = 3 - inSum + yins;\n\t\t\tif (aScore <= bScore && p2 < bScore) {\n\t\t\t\tbScore = p2;\n\t\t\t\tbPoint = 0x0D;\n\t\t\t\tbIsBiggerSide = false;\n\t\t\t} else if (aScore > bScore && p2 < aScore) {\n\t\t\t\taScore = p2;\n\t\t\t\taPoint = 0x0D;\n\t\t\t\taIsBiggerSide = false;\n\t\t\t}\n\t\t\t\n\t\t\t// Decide if (1,1,0,1) is closer.\n\t\t\tdouble p3 = 3 - inSum + zins;\n\t\t\tif (aScore <= bScore && p3 < bScore) {\n\t\t\t\tbScore = p3;\n\t\t\t\tbPoint = 0x0B;\n\t\t\t\tbIsBiggerSide = false;\n\t\t\t} else if (aScore > bScore && p3 < aScore) {\n\t\t\t\taScore = p3;\n\t\t\t\taPoint = 0x0B;\n\t\t\t\taIsBiggerSide = false;\n\t\t\t}\n\t\t\t\n\t\t\t// Decide if (1,1,1,0) is closer.\n\t\t\tdouble p4 = 3 - inSum + wins;\n\t\t\tif (aScore <= bScore && p4 < bScore) {\n\t\t\t\tbScore = p4;\n\t\t\t\tbPoint = 0x07;\n\t\t\t\tbIsBiggerSide = false;\n\t\t\t} else if (aScore > bScore && p4 < aScore) {\n\t\t\t\taScore = p4;\n\t\t\t\taPoint = 0x07;\n\t\t\t\taIsBiggerSide = false;\n\t\t\t}\n\t\t\t\n\t\t\t// Where each of the two closest points are determines how the extra three vertices are calculated.\n\t\t\tif (aIsBiggerSide == bIsBiggerSide) {\n\t\t\t\tif (aIsBiggerSide) { // Both closest points on the bigger side\n\t\t\t\t\tbyte c1 = (byte)(aPoint & bPoint);\n\t\t\t\t\tbyte c2 = (byte)(aPoint | bPoint);\n\t\t\t\t\t\n\t\t\t\t\t// Two contributions are permutations of (0,0,0,1) and (0,0,0,2) based on c1\n\t\t\t\t\txsv_ext0 = xsv_ext1 = xsb;\n\t\t\t\t\tysv_ext0 = ysv_ext1 = ysb;\n\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsb;\n\t\t\t\t\twsv_ext0 = wsv_ext1 = wsb;\n\t\t\t\t\tdx_ext0 = dx0 - SQUISH_CONSTANT_4D;\n\t\t\t\t\tdy_ext0 = dy0 - SQUISH_CONSTANT_4D;\n\t\t\t\t\tdz_ext0 = dz0 - SQUISH_CONSTANT_4D;\n\t\t\t\t\tdw_ext0 = dw0 - SQUISH_CONSTANT_4D;\n\t\t\t\t\tdx_ext1 = dx0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdy_ext1 = dy0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdz_ext1 = dz0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdw_ext1 = dw0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tif ((c1 & 0x01) != 0) {\n\t\t\t\t\t\txsv_ext0 += 1;\n\t\t\t\t\t\tdx_ext0 -= 1;\n\t\t\t\t\t\txsv_ext1 += 2;\n\t\t\t\t\t\tdx_ext1 -= 2;\n\t\t\t\t\t} else if ((c1 & 0x02) != 0) {\n\t\t\t\t\t\tysv_ext0 += 1;\n\t\t\t\t\t\tdy_ext0 -= 1;\n\t\t\t\t\t\tysv_ext1 += 2;\n\t\t\t\t\t\tdy_ext1 -= 2;\n\t\t\t\t\t} else if ((c1 & 0x04) != 0) {\n\t\t\t\t\t\tzsv_ext0 += 1;\n\t\t\t\t\t\tdz_ext0 -= 1;\n\t\t\t\t\t\tzsv_ext1 += 2;\n\t\t\t\t\t\tdz_ext1 -= 2;\n\t\t\t\t\t} else {\n\t\t\t\t\t\twsv_ext0 += 1;\n\t\t\t\t\t\tdw_ext0 -= 1;\n\t\t\t\t\t\twsv_ext1 += 2;\n\t\t\t\t\t\tdw_ext1 -= 2;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// One contribution is a permutation of (1,1,1,-1) based on c2\n\t\t\t\t\txsv_ext2 = xsb + 1;\n\t\t\t\t\tysv_ext2 = ysb + 1;\n\t\t\t\t\tzsv_ext2 = zsb + 1;\n\t\t\t\t\twsv_ext2 = wsb + 1;\n\t\t\t\t\tdx_ext2 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdy_ext2 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdz_ext2 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdw_ext2 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tif ((c2 & 0x01) == 0) {\n\t\t\t\t\t\txsv_ext2 -= 2;\n\t\t\t\t\t\tdx_ext2 += 2;\n\t\t\t\t\t} else if ((c2 & 0x02) == 0) {\n\t\t\t\t\t\tysv_ext2 -= 2;\n\t\t\t\t\t\tdy_ext2 += 2;\n\t\t\t\t\t} else if ((c2 & 0x04) == 0) {\n\t\t\t\t\t\tzsv_ext2 -= 2;\n\t\t\t\t\t\tdz_ext2 += 2;\n\t\t\t\t\t} else {\n\t\t\t\t\t\twsv_ext2 -= 2;\n\t\t\t\t\t\tdw_ext2 += 2;\n\t\t\t\t\t}\n\t\t\t\t} else { // Both closest points on the smaller side\n\t\t\t\t\t// One of the two extra points is (1,1,1,1)\n\t\t\t\t\txsv_ext2 = xsb + 1;\n\t\t\t\t\tysv_ext2 = ysb + 1;\n\t\t\t\t\tzsv_ext2 = zsb + 1;\n\t\t\t\t\twsv_ext2 = wsb + 1;\n\t\t\t\t\tdx_ext2 = dx0 - 1 - 4 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdy_ext2 = dy0 - 1 - 4 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdz_ext2 = dz0 - 1 - 4 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdw_ext2 = dw0 - 1 - 4 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t\n\t\t\t\t\t// Other two points are based on the shared axes.\n\t\t\t\t\tbyte c = (byte)(aPoint & bPoint);\n\t\t\t\t\t\n\t\t\t\t\tif ((c & 0x01) != 0) {\n\t\t\t\t\t\txsv_ext0 = xsb + 2;\n\t\t\t\t\t\txsv_ext1 = xsb + 1;\n\t\t\t\t\t\tdx_ext0 = dx0 - 2 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t\tdx_ext1 = dx0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t} else {\n\t\t\t\t\t\txsv_ext0 = xsv_ext1 = xsb;\n\t\t\t\t\t\tdx_ext0 = dx_ext1 = dx0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ((c & 0x02) != 0) {\n\t\t\t\t\t\tysv_ext0 = ysv_ext1 = ysb + 1;\n\t\t\t\t\t\tdy_ext0 = dy_ext1 = dy0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t\tif ((c & 0x01) == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tysv_ext0 += 1;\n\t\t\t\t\t\t\tdy_ext0 -= 1;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tysv_ext1 += 1;\n\t\t\t\t\t\t\tdy_ext1 -= 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tysv_ext0 = ysv_ext1 = ysb;\n\t\t\t\t\t\tdy_ext0 = dy_ext1 = dy0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ((c & 0x04) != 0) {\n\t\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsb + 1;\n\t\t\t\t\t\tdz_ext0 = dz_ext1 = dz0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t\tif ((c & 0x03) == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tzsv_ext0 += 1;\n\t\t\t\t\t\t\tdz_ext0 -= 1;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tzsv_ext1 += 1;\n\t\t\t\t\t\t\tdz_ext1 -= 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsb;\n\t\t\t\t\t\tdz_ext0 = dz_ext1 = dz0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ((c & 0x08) != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\twsv_ext0 = wsb + 1;\n\t\t\t\t\t\twsv_ext1 = wsb + 2;\n\t\t\t\t\t\tdw_ext0 = dw0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t\tdw_ext1 = dw0 - 2 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t} else {\n\t\t\t\t\t\twsv_ext0 = wsv_ext1 = wsb;\n\t\t\t\t\t\tdw_ext0 = dw_ext1 = dw0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else { // One point on each \"side\"\n\t\t\t\tbyte c1, c2;\n\t\t\t\tif (aIsBiggerSide) {\n\t\t\t\t\tc1 = aPoint;\n\t\t\t\t\tc2 = bPoint;\n\t\t\t\t} else {\n\t\t\t\t\tc1 = bPoint;\n\t\t\t\t\tc2 = aPoint;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Two contributions are the bigger-sided point with each 1 replaced with 2.\n\t\t\t\tif ((c1 & 0x01) != 0) {\n\t\t\t\t\txsv_ext0 = xsb + 2;\n\t\t\t\t\txsv_ext1 = xsb + 1;\n\t\t\t\t\tdx_ext0 = dx0 - 2 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdx_ext1 = dx0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t} else {\n\t\t\t\t\txsv_ext0 = xsv_ext1 = xsb;\n\t\t\t\t\tdx_ext0 = dx_ext1 = dx0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ((c1 & 0x02) != 0) {\n\t\t\t\t\tysv_ext0 = ysv_ext1 = ysb + 1;\n\t\t\t\t\tdy_ext0 = dy_ext1 = dy0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tif ((c1 & 0x01) == 0) {\n\t\t\t\t\t\tysv_ext0 += 1;\n\t\t\t\t\t\tdy_ext0 -= 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tysv_ext1 += 1;\n\t\t\t\t\t\tdy_ext1 -= 1;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tysv_ext0 = ysv_ext1 = ysb;\n\t\t\t\t\tdy_ext0 = dy_ext1 = dy0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ((c1 & 0x04) != 0) {\n\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsb + 1;\n\t\t\t\t\tdz_ext0 = dz_ext1 = dz0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tif ((c1 & 0x03) == 0) {\n\t\t\t\t\t\tzsv_ext0 += 1;\n\t\t\t\t\t\tdz_ext0 -= 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzsv_ext1 += 1;\n\t\t\t\t\t\tdz_ext1 -= 1;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tzsv_ext0 = zsv_ext1 = zsb;\n\t\t\t\t\tdz_ext0 = dz_ext1 = dz0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ((c1 & 0x08) != 0) {\n\t\t\t\t\twsv_ext0 = wsb + 1;\n\t\t\t\t\twsv_ext1 = wsb + 2;\n\t\t\t\t\tdw_ext0 = dw0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t\tdw_ext1 = dw0 - 2 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t} else {\n\t\t\t\t\twsv_ext0 = wsv_ext1 = wsb;\n\t\t\t\t\tdw_ext0 = dw_ext1 = dw0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\t\t}\n\n\t\t\t\t// One contribution is a permutation of (1,1,1,-1) based on the smaller-sided point\n\t\t\t\txsv_ext2 = xsb + 1;\n\t\t\t\tysv_ext2 = ysb + 1;\n\t\t\t\tzsv_ext2 = zsb + 1;\n\t\t\t\twsv_ext2 = wsb + 1;\n\t\t\t\tdx_ext2 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\tdy_ext2 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\tdz_ext2 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\tdw_ext2 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\t\tif ((c2 & 0x01) == 0) {\n\t\t\t\t\txsv_ext2 -= 2;\n\t\t\t\t\tdx_ext2 += 2;\n\t\t\t\t} else if ((c2 & 0x02) == 0) {\n\t\t\t\t\tysv_ext2 -= 2;\n\t\t\t\t\tdy_ext2 += 2;\n\t\t\t\t} else if ((c2 & 0x04) == 0) {\n\t\t\t\t\tzsv_ext2 -= 2;\n\t\t\t\t\tdz_ext2 += 2;\n\t\t\t\t} else {\n\t\t\t\t\twsv_ext2 -= 2;\n\t\t\t\t\tdw_ext2 += 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// Contribution (1,1,1,0)\n\t\t\tdouble dx4 = dx0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dy4 = dy0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dz4 = dz0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dw4 = dw0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\tdouble attn4 = 2 - dx4 * dx4 - dy4 * dy4 - dz4 * dz4 - dw4 * dw4;\n\t\t\tif (attn4 > 0) {\n\t\t\t\tattn4 *= attn4;\n\t\t\t\tvalue += attn4 * attn4 * extrapolate(xsb + 1, ysb + 1, zsb + 1, wsb + 0, dx4, dy4, dz4, dw4);\n\t\t\t}\n\n\t\t\t// Contribution (1,1,0,1)\n\t\t\tdouble dx3 = dx4;\n\t\t\tdouble dy3 = dy4;\n\t\t\tdouble dz3 = dz0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dw3 = dw0 - 1 - 3 * SQUISH_CONSTANT_4D;\n\t\t\tdouble attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3 - dw3 * dw3;\n\t\t\tif (attn3 > 0) {\n\t\t\t\tattn3 *= attn3;\n\t\t\t\tvalue += attn3 * attn3 * extrapolate(xsb + 1, ysb + 1, zsb + 0, wsb + 1, dx3, dy3, dz3, dw3);\n\t\t\t}\n\n\t\t\t// Contribution (1,0,1,1)\n\t\t\tdouble dx2 = dx4;\n\t\t\tdouble dy2 = dy0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dz2 = dz4;\n\t\t\tdouble dw2 = dw3;\n\t\t\tdouble attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2 - dw2 * dw2;\n\t\t\tif (attn2 > 0) {\n\t\t\t\tattn2 *= attn2;\n\t\t\t\tvalue += attn2 * attn2 * extrapolate(xsb + 1, ysb + 0, zsb + 1, wsb + 1, dx2, dy2, dz2, dw2);\n\t\t\t}\n\n\t\t\t// Contribution (0,1,1,1)\n\t\t\tdouble dx1 = dx0 - 3 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dz1 = dz4;\n\t\t\tdouble dy1 = dy4;\n\t\t\tdouble dw1 = dw3;\n\t\t\tdouble attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1 - dw1 * dw1;\n\t\t\tif (attn1 > 0) {\n\t\t\t\tattn1 *= attn1;\n\t\t\t\tvalue += attn1 * attn1 * extrapolate(xsb + 0, ysb + 1, zsb + 1, wsb + 1, dx1, dy1, dz1, dw1);\n\t\t\t}\n\t\t\t\n\t\t\t// Contribution (1,1,0,0)\n\t\t\tdouble dx5 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dy5 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dz5 = dz0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dw5 = dw0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble attn5 = 2 - dx5 * dx5 - dy5 * dy5 - dz5 * dz5 - dw5 * dw5;\n\t\t\tif (attn5 > 0) {\n\t\t\t\tattn5 *= attn5;\n\t\t\t\tvalue += attn5 * attn5 * extrapolate(xsb + 1, ysb + 1, zsb + 0, wsb + 0, dx5, dy5, dz5, dw5);\n\t\t\t}\n\t\t\t\n\t\t\t// Contribution (1,0,1,0)\n\t\t\tdouble dx6 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dy6 = dy0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dz6 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dw6 = dw0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble attn6 = 2 - dx6 * dx6 - dy6 * dy6 - dz6 * dz6 - dw6 * dw6;\n\t\t\tif (attn6 > 0) {\n\t\t\t\tattn6 *= attn6;\n\t\t\t\tvalue += attn6 * attn6 * extrapolate(xsb + 1, ysb + 0, zsb + 1, wsb + 0, dx6, dy6, dz6, dw6);\n\t\t\t}\n\n\t\t\t// Contribution (1,0,0,1)\n\t\t\tdouble dx7 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dy7 = dy0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dz7 = dz0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dw7 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble attn7 = 2 - dx7 * dx7 - dy7 * dy7 - dz7 * dz7 - dw7 * dw7;\n\t\t\tif (attn7 > 0) {\n\t\t\t\tattn7 *= attn7;\n\t\t\t\tvalue += attn7 * attn7 * extrapolate(xsb + 1, ysb + 0, zsb + 0, wsb + 1, dx7, dy7, dz7, dw7);\n\t\t\t}\n\t\t\t\n\t\t\t// Contribution (0,1,1,0)\n\t\t\tdouble dx8 = dx0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dy8 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dz8 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dw8 = dw0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble attn8 = 2 - dx8 * dx8 - dy8 * dy8 - dz8 * dz8 - dw8 * dw8;\n\t\t\tif (attn8 > 0) {\n\t\t\t\tattn8 *= attn8;\n\t\t\t\tvalue += attn8 * attn8 * extrapolate(xsb + 0, ysb + 1, zsb + 1, wsb + 0, dx8, dy8, dz8, dw8);\n\t\t\t}\n\t\t\t\n\t\t\t// Contribution (0,1,0,1)\n\t\t\tdouble dx9 = dx0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dy9 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dz9 = dz0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dw9 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble attn9 = 2 - dx9 * dx9 - dy9 * dy9 - dz9 * dz9 - dw9 * dw9;\n\t\t\tif (attn9 > 0) {\n\t\t\t\tattn9 *= attn9;\n\t\t\t\tvalue += attn9 * attn9 * extrapolate(xsb + 0, ysb + 1, zsb + 0, wsb + 1, dx9, dy9, dz9, dw9);\n\t\t\t}\n\t\t\t\n\t\t\t// Contribution (0,0,1,1)\n\t\t\tdouble dx10 = dx0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dy10 = dy0 - 0 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dz10 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble dw10 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;\n\t\t\tdouble attn10 = 2 - dx10 * dx10 - dy10 * dy10 - dz10 * dz10 - dw10 * dw10;\n\t\t\tif (attn10 > 0) {\n\t\t\t\tattn10 *= attn10;\n\t\t\t\tvalue += attn10 * attn10 * extrapolate(xsb + 0, ysb + 0, zsb + 1, wsb + 1, dx10, dy10, dz10, dw10);\n\t\t\t}\n\t\t}\n \n\t\t// First extra vertex\n\t\tdouble attn_ext0 = 2 - dx_ext0 * dx_ext0 - dy_ext0 * dy_ext0 - dz_ext0 * dz_ext0 - dw_ext0 * dw_ext0;\n\t\tif (attn_ext0 > 0)\n\t\t{\n\t\t\tattn_ext0 *= attn_ext0;\n\t\t\tvalue += attn_ext0 * attn_ext0 * extrapolate(xsv_ext0, ysv_ext0, zsv_ext0, wsv_ext0, dx_ext0, dy_ext0, dz_ext0, dw_ext0);\n\t\t}\n\n\t\t// Second extra vertex\n\t\tdouble attn_ext1 = 2 - dx_ext1 * dx_ext1 - dy_ext1 * dy_ext1 - dz_ext1 * dz_ext1 - dw_ext1 * dw_ext1;\n\t\tif (attn_ext1 > 0)\n\t\t{\n\t\t\tattn_ext1 *= attn_ext1;\n\t\t\tvalue += attn_ext1 * attn_ext1 * extrapolate(xsv_ext1, ysv_ext1, zsv_ext1, wsv_ext1, dx_ext1, dy_ext1, dz_ext1, dw_ext1);\n\t\t}\n\n\t\t// Third extra vertex\n\t\tdouble attn_ext2 = 2 - dx_ext2 * dx_ext2 - dy_ext2 * dy_ext2 - dz_ext2 * dz_ext2 - dw_ext2 * dw_ext2;\n\t\tif (attn_ext2 > 0)\n\t\t{\n\t\t\tattn_ext2 *= attn_ext2;\n\t\t\tvalue += attn_ext2 * attn_ext2 * extrapolate(xsv_ext2, ysv_ext2, zsv_ext2, wsv_ext2, dx_ext2, dy_ext2, dz_ext2, dw_ext2);\n\t\t}\n\n\t\treturn value;\n\t}\n\t\n\tprivate double extrapolate(int xsb, int ysb, double dx, double dy)\n\t{\n\t\tGrad2 grad = permGrad2[perm[xsb & PMASK] ^ (ysb & PMASK)];\n\t\treturn grad.dx * dx + grad.dy * dy;\n\t}\n\t\n\tprivate double extrapolate(int xsb, int ysb, int zsb, double dx, double dy, double dz)\n\t{\n\t\tGrad3 grad = permGrad3[perm[perm[xsb & PMASK] ^ (ysb & PMASK)] ^ (zsb & PMASK)];\n\t\treturn grad.dx * dx + grad.dy * dy + grad.dz * dz;\n\t}\n\t\n\tprivate double extrapolate(int xsb, int ysb, int zsb, int wsb, double dx, double dy, double dz, double dw)\n\t{\n\t\tGrad4 grad = permGrad4[perm[perm[perm[xsb & PMASK] ^ (ysb & PMASK)] ^ (zsb & PMASK)] ^ (wsb & PMASK)];\n\t\treturn grad.dx * dx + grad.dy * dy + grad.dz * dz + grad.dw * dw;\n\t}\n\t\n\tprivate static int fastFloor(double x) {\n\t\tint xi = (int)x;\n\t\treturn x < xi ? xi - 1 : xi;\n\t}\n\t\n\tpublic static class Grad2 {\n\t\tdouble dx, dy;\n\t\tpublic Grad2(double dx, double dy) {\n\t\t\tthis.dx = dx; this.dy = dy;\n\t\t}\n\t}\n\t\n\tpublic static class Grad3 {\n\t\tdouble dx, dy, dz;\n\t\tpublic Grad3(double dx, double dy, double dz) {\n\t\t\tthis.dx = dx; this.dy = dy; this.dz = dz;\n\t\t}\n\t}\n\t\n\tpublic static class Grad4 {\n\t\tdouble dx, dy, dz, dw;\n\t\tpublic Grad4(double dx, double dy, double dz, double dw) {\n\t\t\tthis.dx = dx; this.dy = dy; this.dz = dz; this.dw = dw;\n\t\t}\n\t}\n\t\n\tprivate static final double N2 = 7.69084574549313;\n\tprivate static final double N3 = 26.92263139946168;\n\tprivate static final double N4 = 8.881759591352166;\n\t\n\tprivate static final Grad2[] GRADIENTS_2D = new Grad2[PSIZE];\n\tprivate static final Grad3[] GRADIENTS_3D = new Grad3[PSIZE];\n\tprivate static final Grad4[] GRADIENTS_4D = new Grad4[PSIZE];\n\tstatic {\n\t\tGrad2[] grad2 = {\n\t\t\tnew Grad2( 0.130526192220052,  0.99144486137381),\n\t\t\tnew Grad2( 0.38268343236509,   0.923879532511287),\n\t\t\tnew Grad2( 0.608761429008721,  0.793353340291235),\n\t\t\tnew Grad2( 0.793353340291235,  0.608761429008721),\n\t\t\tnew Grad2( 0.923879532511287,  0.38268343236509),\n\t\t\tnew Grad2( 0.99144486137381,   0.130526192220051),\n\t\t\tnew Grad2( 0.99144486137381,  -0.130526192220051),\n\t\t\tnew Grad2( 0.923879532511287, -0.38268343236509),\n\t\t\tnew Grad2( 0.793353340291235, -0.60876142900872),\n\t\t\tnew Grad2( 0.608761429008721, -0.793353340291235),\n\t\t\tnew Grad2( 0.38268343236509,  -0.923879532511287),\n\t\t\tnew Grad2( 0.130526192220052, -0.99144486137381),\n\t\t\tnew Grad2(-0.130526192220052, -0.99144486137381),\n\t\t\tnew Grad2(-0.38268343236509,  -0.923879532511287),\n\t\t\tnew Grad2(-0.608761429008721, -0.793353340291235),\n\t\t\tnew Grad2(-0.793353340291235, -0.608761429008721),\n\t\t\tnew Grad2(-0.923879532511287, -0.38268343236509),\n\t\t\tnew Grad2(-0.99144486137381,  -0.130526192220052),\n\t\t\tnew Grad2(-0.99144486137381,   0.130526192220051),\n\t\t\tnew Grad2(-0.923879532511287,  0.38268343236509),\n\t\t\tnew Grad2(-0.793353340291235,  0.608761429008721),\n\t\t\tnew Grad2(-0.608761429008721,  0.793353340291235),\n\t\t\tnew Grad2(-0.38268343236509,   0.923879532511287),\n\t\t\tnew Grad2(-0.130526192220052,  0.99144486137381)\n\t\t};\n\t\tfor (int i = 0; i < grad2.length; i++) {\n\t\t\tgrad2[i].dx /= N2; grad2[i].dy /= N2;\n\t\t}\n\t\tfor (int i = 0; i < PSIZE; i++) {\n\t\t\tGRADIENTS_2D[i] = grad2[i % grad2.length];\n\t\t}\n\t\t\n\t\tGrad3[] grad3 = {\n\t\t\tnew Grad3(-1.4082482904633333,    -1.4082482904633333,    -2.6329931618533333),\n\t\t\tnew Grad3(-0.07491495712999985,   -0.07491495712999985,   -3.29965982852),\n\t\t\tnew Grad3( 0.24732126143473554,   -1.6667938651159684,    -2.838945207362466),\n\t\t\tnew Grad3(-1.6667938651159684,     0.24732126143473554,   -2.838945207362466),\n\t\t\tnew Grad3(-1.4082482904633333,    -2.6329931618533333,    -1.4082482904633333),\n\t\t\tnew Grad3(-0.07491495712999985,   -3.29965982852,         -0.07491495712999985),\n\t\t\tnew Grad3(-1.6667938651159684,    -2.838945207362466,      0.24732126143473554),\n\t\t\tnew Grad3( 0.24732126143473554,   -2.838945207362466,     -1.6667938651159684),\n\t\t\tnew Grad3( 1.5580782047233335,     0.33333333333333337,   -2.8914115380566665),\n\t\t\tnew Grad3( 2.8914115380566665,    -0.33333333333333337,   -1.5580782047233335),\n\t\t\tnew Grad3( 1.8101897177633992,    -1.2760767510338025,    -2.4482280932803),\n\t\t\tnew Grad3( 2.4482280932803,        1.2760767510338025,    -1.8101897177633992),\n\t\t\tnew Grad3( 1.5580782047233335,    -2.8914115380566665,     0.33333333333333337),\n\t\t\tnew Grad3( 2.8914115380566665,    -1.5580782047233335,    -0.33333333333333337),\n\t\t\tnew Grad3( 2.4482280932803,       -1.8101897177633992,     1.2760767510338025),\n\t\t\tnew Grad3( 1.8101897177633992,    -2.4482280932803,       -1.2760767510338025),\n\t\t\tnew Grad3(-2.6329931618533333,    -1.4082482904633333,    -1.4082482904633333),\n\t\t\tnew Grad3(-3.29965982852,         -0.07491495712999985,   -0.07491495712999985),\n\t\t\tnew Grad3(-2.838945207362466,      0.24732126143473554,   -1.6667938651159684),\n\t\t\tnew Grad3(-2.838945207362466,     -1.6667938651159684,     0.24732126143473554),\n\t\t\tnew Grad3( 0.33333333333333337,    1.5580782047233335,    -2.8914115380566665),\n\t\t\tnew Grad3(-0.33333333333333337,    2.8914115380566665,    -1.5580782047233335),\n\t\t\tnew Grad3( 1.2760767510338025,     2.4482280932803,       -1.8101897177633992),\n\t\t\tnew Grad3(-1.2760767510338025,     1.8101897177633992,    -2.4482280932803),\n\t\t\tnew Grad3( 0.33333333333333337,   -2.8914115380566665,     1.5580782047233335),\n\t\t\tnew Grad3(-0.33333333333333337,   -1.5580782047233335,     2.8914115380566665),\n\t\t\tnew Grad3(-1.2760767510338025,    -2.4482280932803,        1.8101897177633992),\n\t\t\tnew Grad3( 1.2760767510338025,    -1.8101897177633992,     2.4482280932803),\n\t\t\tnew Grad3( 3.29965982852,          0.07491495712999985,    0.07491495712999985),\n\t\t\tnew Grad3( 2.6329931618533333,     1.4082482904633333,     1.4082482904633333),\n\t\t\tnew Grad3( 2.838945207362466,     -0.24732126143473554,    1.6667938651159684),\n\t\t\tnew Grad3( 2.838945207362466,      1.6667938651159684,    -0.24732126143473554),\n\t\t\tnew Grad3(-2.8914115380566665,     1.5580782047233335,     0.33333333333333337),\n\t\t\tnew Grad3(-1.5580782047233335,     2.8914115380566665,    -0.33333333333333337),\n\t\t\tnew Grad3(-2.4482280932803,        1.8101897177633992,    -1.2760767510338025),\n\t\t\tnew Grad3(-1.8101897177633992,     2.4482280932803,        1.2760767510338025),\n\t\t\tnew Grad3(-2.8914115380566665,     0.33333333333333337,    1.5580782047233335),\n\t\t\tnew Grad3(-1.5580782047233335,    -0.33333333333333337,    2.8914115380566665),\n\t\t\tnew Grad3(-1.8101897177633992,     1.2760767510338025,     2.4482280932803),\n\t\t\tnew Grad3(-2.4482280932803,       -1.2760767510338025,     1.8101897177633992),\n\t\t\tnew Grad3( 0.07491495712999985,    3.29965982852,          0.07491495712999985),\n\t\t\tnew Grad3( 1.4082482904633333,     2.6329931618533333,     1.4082482904633333),\n\t\t\tnew Grad3( 1.6667938651159684,     2.838945207362466,     -0.24732126143473554),\n\t\t\tnew Grad3(-0.24732126143473554,    2.838945207362466,      1.6667938651159684),\n\t\t\tnew Grad3( 0.07491495712999985,    0.07491495712999985,    3.29965982852),\n\t\t\tnew Grad3( 1.4082482904633333,     1.4082482904633333,     2.6329931618533333),\n\t\t\tnew Grad3(-0.24732126143473554,    1.6667938651159684,     2.838945207362466),\n\t\t\tnew Grad3( 1.6667938651159684,    -0.24732126143473554,    2.838945207362466)\n\t\t};\n\t\tfor (int i = 0; i < grad3.length; i++) {\n\t\t\tgrad3[i].dx /= N3; grad3[i].dy /= N3; grad3[i].dz /= N3;\n\t\t}\n\t\tfor (int i = 0; i < PSIZE; i++) {\n\t\t\tGRADIENTS_3D[i] = grad3[i % grad3.length];\n\t\t}\n\t\t\n\t\tGrad4[] grad4 = {\n\t\t\tnew Grad4(-0.753341017856078,    -0.37968289875261624,  -0.37968289875261624,  -0.37968289875261624),\n\t\t\tnew Grad4(-0.7821684431180708,   -0.4321472685365301,   -0.4321472685365301,    0.12128480194602098),\n\t\t\tnew Grad4(-0.7821684431180708,   -0.4321472685365301,    0.12128480194602098,  -0.4321472685365301),\n\t\t\tnew Grad4(-0.7821684431180708,    0.12128480194602098,  -0.4321472685365301,   -0.4321472685365301),\n\t\t\tnew Grad4(-0.8586508742123365,   -0.508629699630796,     0.044802370851755174,  0.044802370851755174),\n\t\t\tnew Grad4(-0.8586508742123365,    0.044802370851755174, -0.508629699630796,     0.044802370851755174),\n\t\t\tnew Grad4(-0.8586508742123365,    0.044802370851755174,  0.044802370851755174, -0.508629699630796),\n\t\t\tnew Grad4(-0.9982828964265062,   -0.03381941603233842,  -0.03381941603233842,  -0.03381941603233842),\n\t\t\tnew Grad4(-0.37968289875261624,  -0.753341017856078,    -0.37968289875261624,  -0.37968289875261624),\n\t\t\tnew Grad4(-0.4321472685365301,   -0.7821684431180708,   -0.4321472685365301,    0.12128480194602098),\n\t\t\tnew Grad4(-0.4321472685365301,   -0.7821684431180708,    0.12128480194602098,  -0.4321472685365301),\n\t\t\tnew Grad4( 0.12128480194602098,  -0.7821684431180708,   -0.4321472685365301,   -0.4321472685365301),\n\t\t\tnew Grad4(-0.508629699630796,    -0.8586508742123365,    0.044802370851755174,  0.044802370851755174),\n\t\t\tnew Grad4( 0.044802370851755174, -0.8586508742123365,   -0.508629699630796,     0.044802370851755174),\n\t\t\tnew Grad4( 0.044802370851755174, -0.8586508742123365,    0.044802370851755174, -0.508629699630796),\n\t\t\tnew Grad4(-0.03381941603233842,  -0.9982828964265062,   -0.03381941603233842,  -0.03381941603233842),\n\t\t\tnew Grad4(-0.37968289875261624,  -0.37968289875261624,  -0.753341017856078,    -0.37968289875261624),\n\t\t\tnew Grad4(-0.4321472685365301,   -0.4321472685365301,   -0.7821684431180708,    0.12128480194602098),\n\t\t\tnew Grad4(-0.4321472685365301,    0.12128480194602098,  -0.7821684431180708,   -0.4321472685365301),\n\t\t\tnew Grad4( 0.12128480194602098,  -0.4321472685365301,   -0.7821684431180708,   -0.4321472685365301),\n\t\t\tnew Grad4(-0.508629699630796,     0.044802370851755174, -0.8586508742123365,    0.044802370851755174),\n\t\t\tnew Grad4( 0.044802370851755174, -0.508629699630796,    -0.8586508742123365,    0.044802370851755174),\n\t\t\tnew Grad4( 0.044802370851755174,  0.044802370851755174, -0.8586508742123365,   -0.508629699630796),\n\t\t\tnew Grad4(-0.03381941603233842,  -0.03381941603233842,  -0.9982828964265062,   -0.03381941603233842),\n\t\t\tnew Grad4(-0.37968289875261624,  -0.37968289875261624,  -0.37968289875261624,  -0.753341017856078),\n\t\t\tnew Grad4(-0.4321472685365301,   -0.4321472685365301,    0.12128480194602098,  -0.7821684431180708),\n\t\t\tnew Grad4(-0.4321472685365301,    0.12128480194602098,  -0.4321472685365301,   -0.7821684431180708),\n\t\t\tnew Grad4( 0.12128480194602098,  -0.4321472685365301,   -0.4321472685365301,   -0.7821684431180708),\n\t\t\tnew Grad4(-0.508629699630796,     0.044802370851755174,  0.044802370851755174, -0.8586508742123365),\n\t\t\tnew Grad4( 0.044802370851755174, -0.508629699630796,     0.044802370851755174, -0.8586508742123365),\n\t\t\tnew Grad4( 0.044802370851755174,  0.044802370851755174, -0.508629699630796,    -0.8586508742123365),\n\t\t\tnew Grad4(-0.03381941603233842,  -0.03381941603233842,  -0.03381941603233842,  -0.9982828964265062),\n\t\t\tnew Grad4(-0.6740059517812944,   -0.3239847771997537,   -0.3239847771997537,    0.5794684678643381),\n\t\t\tnew Grad4(-0.7504883828755602,   -0.4004672082940195,    0.15296486218853164,   0.5029860367700724),\n\t\t\tnew Grad4(-0.7504883828755602,    0.15296486218853164,  -0.4004672082940195,    0.5029860367700724),\n\t\t\tnew Grad4(-0.8828161875373585,    0.08164729285680945,   0.08164729285680945,   0.4553054119602712),\n\t\t\tnew Grad4(-0.4553054119602712,   -0.08164729285680945,  -0.08164729285680945,   0.8828161875373585),\n\t\t\tnew Grad4(-0.5029860367700724,   -0.15296486218853164,   0.4004672082940195,    0.7504883828755602),\n\t\t\tnew Grad4(-0.5029860367700724,    0.4004672082940195,   -0.15296486218853164,   0.7504883828755602),\n\t\t\tnew Grad4(-0.5794684678643381,    0.3239847771997537,    0.3239847771997537,    0.6740059517812944),\n\t\t\tnew Grad4(-0.3239847771997537,   -0.6740059517812944,   -0.3239847771997537,    0.5794684678643381),\n\t\t\tnew Grad4(-0.4004672082940195,   -0.7504883828755602,    0.15296486218853164,   0.5029860367700724),\n\t\t\tnew Grad4( 0.15296486218853164,  -0.7504883828755602,   -0.4004672082940195,    0.5029860367700724),\n\t\t\tnew Grad4( 0.08164729285680945,  -0.8828161875373585,    0.08164729285680945,   0.4553054119602712),\n\t\t\tnew Grad4(-0.08164729285680945,  -0.4553054119602712,   -0.08164729285680945,   0.8828161875373585),\n\t\t\tnew Grad4(-0.15296486218853164,  -0.5029860367700724,    0.4004672082940195,    0.7504883828755602),\n\t\t\tnew Grad4( 0.4004672082940195,   -0.5029860367700724,   -0.15296486218853164,   0.7504883828755602),\n\t\t\tnew Grad4( 0.3239847771997537,   -0.5794684678643381,    0.3239847771997537,    0.6740059517812944),\n\t\t\tnew Grad4(-0.3239847771997537,   -0.3239847771997537,   -0.6740059517812944,    0.5794684678643381),\n\t\t\tnew Grad4(-0.4004672082940195,    0.15296486218853164,  -0.7504883828755602,    0.5029860367700724),\n\t\t\tnew Grad4( 0.15296486218853164,  -0.4004672082940195,   -0.7504883828755602,    0.5029860367700724),\n\t\t\tnew Grad4( 0.08164729285680945,   0.08164729285680945,  -0.8828161875373585,    0.4553054119602712),\n\t\t\tnew Grad4(-0.08164729285680945,  -0.08164729285680945,  -0.4553054119602712,    0.8828161875373585),\n\t\t\tnew Grad4(-0.15296486218853164,   0.4004672082940195,   -0.5029860367700724,    0.7504883828755602),\n\t\t\tnew Grad4( 0.4004672082940195,   -0.15296486218853164,  -0.5029860367700724,    0.7504883828755602),\n\t\t\tnew Grad4( 0.3239847771997537,    0.3239847771997537,   -0.5794684678643381,    0.6740059517812944),\n\t\t\tnew Grad4(-0.6740059517812944,   -0.3239847771997537,    0.5794684678643381,   -0.3239847771997537),\n\t\t\tnew Grad4(-0.7504883828755602,   -0.4004672082940195,    0.5029860367700724,    0.15296486218853164),\n\t\t\tnew Grad4(-0.7504883828755602,    0.15296486218853164,   0.5029860367700724,   -0.4004672082940195),\n\t\t\tnew Grad4(-0.8828161875373585,    0.08164729285680945,   0.4553054119602712,    0.08164729285680945),\n\t\t\tnew Grad4(-0.4553054119602712,   -0.08164729285680945,   0.8828161875373585,   -0.08164729285680945),\n\t\t\tnew Grad4(-0.5029860367700724,   -0.15296486218853164,   0.7504883828755602,    0.4004672082940195),\n\t\t\tnew Grad4(-0.5029860367700724,    0.4004672082940195,    0.7504883828755602,   -0.15296486218853164),\n\t\t\tnew Grad4(-0.5794684678643381,    0.3239847771997537,    0.6740059517812944,    0.3239847771997537),\n\t\t\tnew Grad4(-0.3239847771997537,   -0.6740059517812944,    0.5794684678643381,   -0.3239847771997537),\n\t\t\tnew Grad4(-0.4004672082940195,   -0.7504883828755602,    0.5029860367700724,    0.15296486218853164),\n\t\t\tnew Grad4( 0.15296486218853164,  -0.7504883828755602,    0.5029860367700724,   -0.4004672082940195),\n\t\t\tnew Grad4( 0.08164729285680945,  -0.8828161875373585,    0.4553054119602712,    0.08164729285680945),\n\t\t\tnew Grad4(-0.08164729285680945,  -0.4553054119602712,    0.8828161875373585,   -0.08164729285680945),\n\t\t\tnew Grad4(-0.15296486218853164,  -0.5029860367700724,    0.7504883828755602,    0.4004672082940195),\n\t\t\tnew Grad4( 0.4004672082940195,   -0.5029860367700724,    0.7504883828755602,   -0.15296486218853164),\n\t\t\tnew Grad4( 0.3239847771997537,   -0.5794684678643381,    0.6740059517812944,    0.3239847771997537),\n\t\t\tnew Grad4(-0.3239847771997537,   -0.3239847771997537,    0.5794684678643381,   -0.6740059517812944),\n\t\t\tnew Grad4(-0.4004672082940195,    0.15296486218853164,   0.5029860367700724,   -0.7504883828755602),\n\t\t\tnew Grad4( 0.15296486218853164,  -0.4004672082940195,    0.5029860367700724,   -0.7504883828755602),\n\t\t\tnew Grad4( 0.08164729285680945,   0.08164729285680945,   0.4553054119602712,   -0.8828161875373585),\n\t\t\tnew Grad4(-0.08164729285680945,  -0.08164729285680945,   0.8828161875373585,   -0.4553054119602712),\n\t\t\tnew Grad4(-0.15296486218853164,   0.4004672082940195,    0.7504883828755602,   -0.5029860367700724),\n\t\t\tnew Grad4( 0.4004672082940195,   -0.15296486218853164,   0.7504883828755602,   -0.5029860367700724),\n\t\t\tnew Grad4( 0.3239847771997537,    0.3239847771997537,    0.6740059517812944,   -0.5794684678643381),\n\t\t\tnew Grad4(-0.6740059517812944,    0.5794684678643381,   -0.3239847771997537,   -0.3239847771997537),\n\t\t\tnew Grad4(-0.7504883828755602,    0.5029860367700724,   -0.4004672082940195,    0.15296486218853164),\n\t\t\tnew Grad4(-0.7504883828755602,    0.5029860367700724,    0.15296486218853164,  -0.4004672082940195),\n\t\t\tnew Grad4(-0.8828161875373585,    0.4553054119602712,    0.08164729285680945,   0.08164729285680945),\n\t\t\tnew Grad4(-0.4553054119602712,    0.8828161875373585,   -0.08164729285680945,  -0.08164729285680945),\n\t\t\tnew Grad4(-0.5029860367700724,    0.7504883828755602,   -0.15296486218853164,   0.4004672082940195),\n\t\t\tnew Grad4(-0.5029860367700724,    0.7504883828755602,    0.4004672082940195,   -0.15296486218853164),\n\t\t\tnew Grad4(-0.5794684678643381,    0.6740059517812944,    0.3239847771997537,    0.3239847771997537),\n\t\t\tnew Grad4(-0.3239847771997537,    0.5794684678643381,   -0.6740059517812944,   -0.3239847771997537),\n\t\t\tnew Grad4(-0.4004672082940195,    0.5029860367700724,   -0.7504883828755602,    0.15296486218853164),\n\t\t\tnew Grad4( 0.15296486218853164,   0.5029860367700724,   -0.7504883828755602,   -0.4004672082940195),\n\t\t\tnew Grad4( 0.08164729285680945,   0.4553054119602712,   -0.8828161875373585,    0.08164729285680945),\n\t\t\tnew Grad4(-0.08164729285680945,   0.8828161875373585,   -0.4553054119602712,   -0.08164729285680945),\n\t\t\tnew Grad4(-0.15296486218853164,   0.7504883828755602,   -0.5029860367700724,    0.4004672082940195),\n\t\t\tnew Grad4( 0.4004672082940195,    0.7504883828755602,   -0.5029860367700724,   -0.15296486218853164),\n\t\t\tnew Grad4( 0.3239847771997537,    0.6740059517812944,   -0.5794684678643381,    0.3239847771997537),\n\t\t\tnew Grad4(-0.3239847771997537,    0.5794684678643381,   -0.3239847771997537,   -0.6740059517812944),\n\t\t\tnew Grad4(-0.4004672082940195,    0.5029860367700724,    0.15296486218853164,  -0.7504883828755602),\n\t\t\tnew Grad4( 0.15296486218853164,   0.5029860367700724,   -0.4004672082940195,   -0.7504883828755602),\n\t\t\tnew Grad4( 0.08164729285680945,   0.4553054119602712,    0.08164729285680945,  -0.8828161875373585),\n\t\t\tnew Grad4(-0.08164729285680945,   0.8828161875373585,   -0.08164729285680945,  -0.4553054119602712),\n\t\t\tnew Grad4(-0.15296486218853164,   0.7504883828755602,    0.4004672082940195,   -0.5029860367700724),\n\t\t\tnew Grad4( 0.4004672082940195,    0.7504883828755602,   -0.15296486218853164,  -0.5029860367700724),\n\t\t\tnew Grad4( 0.3239847771997537,    0.6740059517812944,    0.3239847771997537,   -0.5794684678643381),\n\t\t\tnew Grad4( 0.5794684678643381,   -0.6740059517812944,   -0.3239847771997537,   -0.3239847771997537),\n\t\t\tnew Grad4( 0.5029860367700724,   -0.7504883828755602,   -0.4004672082940195,    0.15296486218853164),\n\t\t\tnew Grad4( 0.5029860367700724,   -0.7504883828755602,    0.15296486218853164,  -0.4004672082940195),\n\t\t\tnew Grad4( 0.4553054119602712,   -0.8828161875373585,    0.08164729285680945,   0.08164729285680945),\n\t\t\tnew Grad4( 0.8828161875373585,   -0.4553054119602712,   -0.08164729285680945,  -0.08164729285680945),\n\t\t\tnew Grad4( 0.7504883828755602,   -0.5029860367700724,   -0.15296486218853164,   0.4004672082940195),\n\t\t\tnew Grad4( 0.7504883828755602,   -0.5029860367700724,    0.4004672082940195,   -0.15296486218853164),\n\t\t\tnew Grad4( 0.6740059517812944,   -0.5794684678643381,    0.3239847771997537,    0.3239847771997537),\n\t\t\tnew Grad4( 0.5794684678643381,   -0.3239847771997537,   -0.6740059517812944,   -0.3239847771997537),\n\t\t\tnew Grad4( 0.5029860367700724,   -0.4004672082940195,   -0.7504883828755602,    0.15296486218853164),\n\t\t\tnew Grad4( 0.5029860367700724,    0.15296486218853164,  -0.7504883828755602,   -0.4004672082940195),\n\t\t\tnew Grad4( 0.4553054119602712,    0.08164729285680945,  -0.8828161875373585,    0.08164729285680945),\n\t\t\tnew Grad4( 0.8828161875373585,   -0.08164729285680945,  -0.4553054119602712,   -0.08164729285680945),\n\t\t\tnew Grad4( 0.7504883828755602,   -0.15296486218853164,  -0.5029860367700724,    0.4004672082940195),\n\t\t\tnew Grad4( 0.7504883828755602,    0.4004672082940195,   -0.5029860367700724,   -0.15296486218853164),\n\t\t\tnew Grad4( 0.6740059517812944,    0.3239847771997537,   -0.5794684678643381,    0.3239847771997537),\n\t\t\tnew Grad4( 0.5794684678643381,   -0.3239847771997537,   -0.3239847771997537,   -0.6740059517812944),\n\t\t\tnew Grad4( 0.5029860367700724,   -0.4004672082940195,    0.15296486218853164,  -0.7504883828755602),\n\t\t\tnew Grad4( 0.5029860367700724,    0.15296486218853164,  -0.4004672082940195,   -0.7504883828755602),\n\t\t\tnew Grad4( 0.4553054119602712,    0.08164729285680945,   0.08164729285680945,  -0.8828161875373585),\n\t\t\tnew Grad4( 0.8828161875373585,   -0.08164729285680945,  -0.08164729285680945,  -0.4553054119602712),\n\t\t\tnew Grad4( 0.7504883828755602,   -0.15296486218853164,   0.4004672082940195,   -0.5029860367700724),\n\t\t\tnew Grad4( 0.7504883828755602,    0.4004672082940195,   -0.15296486218853164,  -0.5029860367700724),\n\t\t\tnew Grad4( 0.6740059517812944,    0.3239847771997537,    0.3239847771997537,   -0.5794684678643381),\n\t\t\tnew Grad4( 0.03381941603233842,   0.03381941603233842,   0.03381941603233842,   0.9982828964265062),\n\t\t\tnew Grad4(-0.044802370851755174, -0.044802370851755174,  0.508629699630796,     0.8586508742123365),\n\t\t\tnew Grad4(-0.044802370851755174,  0.508629699630796,    -0.044802370851755174,  0.8586508742123365),\n\t\t\tnew Grad4(-0.12128480194602098,   0.4321472685365301,    0.4321472685365301,    0.7821684431180708),\n\t\t\tnew Grad4( 0.508629699630796,    -0.044802370851755174, -0.044802370851755174,  0.8586508742123365),\n\t\t\tnew Grad4( 0.4321472685365301,   -0.12128480194602098,   0.4321472685365301,    0.7821684431180708),\n\t\t\tnew Grad4( 0.4321472685365301,    0.4321472685365301,   -0.12128480194602098,   0.7821684431180708),\n\t\t\tnew Grad4( 0.37968289875261624,   0.37968289875261624,   0.37968289875261624,   0.753341017856078),\n\t\t\tnew Grad4( 0.03381941603233842,   0.03381941603233842,   0.9982828964265062,    0.03381941603233842),\n\t\t\tnew Grad4(-0.044802370851755174,  0.044802370851755174,  0.8586508742123365,    0.508629699630796),\n\t\t\tnew Grad4(-0.044802370851755174,  0.508629699630796,     0.8586508742123365,   -0.044802370851755174),\n\t\t\tnew Grad4(-0.12128480194602098,   0.4321472685365301,    0.7821684431180708,    0.4321472685365301),\n\t\t\tnew Grad4( 0.508629699630796,    -0.044802370851755174,  0.8586508742123365,   -0.044802370851755174),\n\t\t\tnew Grad4( 0.4321472685365301,   -0.12128480194602098,   0.7821684431180708,    0.4321472685365301),\n\t\t\tnew Grad4( 0.4321472685365301,    0.4321472685365301,    0.7821684431180708,   -0.12128480194602098),\n\t\t\tnew Grad4( 0.37968289875261624,   0.37968289875261624,   0.753341017856078,     0.37968289875261624),\n\t\t\tnew Grad4( 0.03381941603233842,   0.9982828964265062,    0.03381941603233842,   0.03381941603233842),\n\t\t\tnew Grad4(-0.044802370851755174,  0.8586508742123365,   -0.044802370851755174,  0.508629699630796),\n\t\t\tnew Grad4(-0.044802370851755174,  0.8586508742123365,    0.508629699630796,    -0.044802370851755174),\n\t\t\tnew Grad4(-0.12128480194602098,   0.7821684431180708,    0.4321472685365301,    0.4321472685365301),\n\t\t\tnew Grad4( 0.508629699630796,     0.8586508742123365,   -0.044802370851755174, -0.044802370851755174),\n\t\t\tnew Grad4( 0.4321472685365301,    0.7821684431180708,   -0.12128480194602098,   0.4321472685365301),\n\t\t\tnew Grad4( 0.4321472685365301,    0.7821684431180708,    0.4321472685365301,   -0.12128480194602098),\n\t\t\tnew Grad4( 0.37968289875261624,   0.753341017856078,     0.37968289875261624,   0.37968289875261624),\n\t\t\tnew Grad4( 0.9982828964265062,    0.03381941603233842,   0.03381941603233842,   0.03381941603233842),\n\t\t\tnew Grad4( 0.8586508742123365,   -0.044802370851755174, -0.044802370851755174,  0.508629699630796),\n\t\t\tnew Grad4( 0.8586508742123365,   -0.044802370851755174,  0.508629699630796,    -0.044802370851755174),\n\t\t\tnew Grad4( 0.7821684431180708,   -0.12128480194602098,   0.4321472685365301,    0.4321472685365301),\n\t\t\tnew Grad4( 0.8586508742123365,    0.508629699630796,    -0.044802370851755174, -0.044802370851755174),\n\t\t\tnew Grad4( 0.7821684431180708,    0.4321472685365301,   -0.12128480194602098,   0.4321472685365301),\n\t\t\tnew Grad4( 0.7821684431180708,    0.4321472685365301,    0.4321472685365301,   -0.12128480194602098),\n\t\t\tnew Grad4( 0.753341017856078,     0.37968289875261624,   0.37968289875261624,   0.37968289875261624)\n\t\t};\n\t\tfor (int i = 0; i < grad4.length; i++) {\n\t\t\tgrad4[i].dx /= N4; grad4[i].dy /= N4; grad4[i].dz /= N4; grad4[i].dw /= N4;\n\t\t}\n\t\tfor (int i = 0; i < PSIZE; i++) {\n\t\t\tGRADIENTS_4D[i] = grad4[i % grad4.length];\n\t\t}\n\t}\n\t\n}"
  },
  {
    "path": "csharp/OpenSimplex2.cs",
    "content": "/**\n * K.jpg's OpenSimplex 2, faster variant\n */\n\nusing System.Runtime.CompilerServices;\n\npublic static class OpenSimplex2\n{\n    private const long PRIME_X = 0x5205402B9270C86FL;\n    private const long PRIME_Y = 0x598CD327003817B5L;\n    private const long PRIME_Z = 0x5BCC226E9FA0BACBL;\n    private const long PRIME_W = 0x56CC5227E58F554BL;\n    private const long HASH_MULTIPLIER = 0x53A3F72DEEC546F5L;\n    private const long SEED_FLIP_3D = -0x52D547B2E96ED629L;\n    private const long SEED_OFFSET_4D = 0xE83DC3E0DA7164DL;\n\n    private const double ROOT2OVER2 = 0.7071067811865476;\n    private const double SKEW_2D = 0.366025403784439;\n    private const double UNSKEW_2D = -0.21132486540518713;\n\n    private const double ROOT3OVER3 = 0.577350269189626;\n    private const double FALLBACK_ROTATE_3D = 2.0 / 3.0;\n    private const double ROTATE_3D_ORTHOGONALIZER = UNSKEW_2D;\n\n    private const float SKEW_4D = -0.138196601125011f;\n    private const float UNSKEW_4D = 0.309016994374947f;\n    private const float LATTICE_STEP_4D = 0.2f;\n\n    private const int N_GRADS_2D_EXPONENT = 7;\n    private const int N_GRADS_3D_EXPONENT = 8;\n    private const int N_GRADS_4D_EXPONENT = 9;\n    private const int N_GRADS_2D = 1 << N_GRADS_2D_EXPONENT;\n    private const int N_GRADS_3D = 1 << N_GRADS_3D_EXPONENT;\n    private const int N_GRADS_4D = 1 << N_GRADS_4D_EXPONENT;\n\n    private const double NORMALIZER_2D = 0.01001634121365712;\n    private const double NORMALIZER_3D = 0.07969837668935331;\n    private const double NORMALIZER_4D = 0.0220065933241897;\n\n    private const float RSQUARED_2D = 0.5f;\n    private const float RSQUARED_3D = 0.6f;\n    private const float RSQUARED_4D = 0.6f;\n\n\n    /*\n     * Noise Evaluators\n     */\n\n    /**\n     * 2D Simplex noise, standard lattice orientation.\n     */\n    public static float Noise2(long seed, double x, double y)\n    {\n        // Get points for A2* lattice\n        double s = SKEW_2D * (x + y);\n        double xs = x + s, ys = y + s;\n\n        return Noise2_UnskewedBase(seed, xs, ys);\n    }\n\n    /**\n     * 2D Simplex noise, with Y pointing down the main diagonal.\n     * Might be better for a 2D sandbox style game, where Y is vertical.\n     * Probably slightly less optimal for heightmaps or continent maps,\n     * unless your map is centered around an equator. It's a subtle\n     * difference, but the option is here to make it an easy choice.\n     */\n    public static float Noise2_ImproveX(long seed, double x, double y)\n    {\n        // Skew transform and rotation baked into one.\n        double xx = x * ROOT2OVER2;\n        double yy = y * (ROOT2OVER2 * (1 + 2 * SKEW_2D));\n\n        return Noise2_UnskewedBase(seed, yy + xx, yy - xx);\n    }\n\n    /**\n     * 2D Simplex noise base.\n     */\n    private static float Noise2_UnskewedBase(long seed, double xs, double ys)\n    {\n        // Get base points and offsets.\n        int xsb = FastFloor(xs), ysb = FastFloor(ys);\n        float xi = (float)(xs - xsb), yi = (float)(ys - ysb);\n\n        // Prime pre-multiplication for hash.\n        long xsbp = xsb * PRIME_X, ysbp = ysb * PRIME_Y;\n\n        // Unskew.\n        float t = (xi + yi) * (float)UNSKEW_2D;\n        float dx0 = xi + t, dy0 = yi + t;\n\n        // First vertex.\n        float value = 0;\n        float a0 = RSQUARED_2D - dx0 * dx0 - dy0 * dy0;\n        if (a0 > 0)\n        {\n            value = (a0 * a0) * (a0 * a0) * Grad(seed, xsbp, ysbp, dx0, dy0);\n        }\n\n        // Second vertex.\n        float a1 = (float)(2 * (1 + 2 * UNSKEW_2D) * (1 / UNSKEW_2D + 2)) * t + ((float)(-2 * (1 + 2 * UNSKEW_2D) * (1 + 2 * UNSKEW_2D)) + a0);\n        if (a1 > 0)\n        {\n            float dx1 = dx0 - (float)(1 + 2 * UNSKEW_2D);\n            float dy1 = dy0 - (float)(1 + 2 * UNSKEW_2D);\n            value += (a1 * a1) * (a1 * a1) * Grad(seed, xsbp + PRIME_X, ysbp + PRIME_Y, dx1, dy1);\n        }\n\n        // Third vertex.\n        if (dy0 > dx0)\n        {\n            float dx2 = dx0 - (float)UNSKEW_2D;\n            float dy2 = dy0 - (float)(UNSKEW_2D + 1);\n            float a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n            if (a2 > 0)\n            {\n                value += (a2 * a2) * (a2 * a2) * Grad(seed, xsbp, ysbp + PRIME_Y, dx2, dy2);\n            }\n        }\n        else\n        {\n            float dx2 = dx0 - (float)(UNSKEW_2D + 1);\n            float dy2 = dy0 - (float)UNSKEW_2D;\n            float a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n            if (a2 > 0)\n            {\n                value += (a2 * a2) * (a2 * a2) * Grad(seed, xsbp + PRIME_X, ysbp, dx2, dy2);\n            }\n        }\n\n        return value;\n    }\n\n    /**\n     * 3D OpenSimplex2 noise, with better visual isotropy in (X, Y).\n     * Recommended for 3D terrain and time-varied animations.\n     * The Z coordinate should always be the \"different\" coordinate in whatever your use case is.\n     * If Y is vertical in world coordinates, call Noise3_ImproveXZ(x, z, Y) or use noise3_XZBeforeY.\n     * If Z is vertical in world coordinates, call Noise3_ImproveXZ(x, y, Z).\n     * For a time varied animation, call Noise3_ImproveXY(x, y, T).\n     */\n    public static float Noise3_ImproveXY(long seed, double x, double y, double z)\n    {\n        // Re-orient the cubic lattices without skewing, so Z points up the main lattice diagonal,\n        // and the planes formed by XY are moved far out of alignment with the cube faces.\n        // Orthonormal rotation. Not a skew transform.\n        double xy = x + y;\n        double s2 = xy * ROTATE_3D_ORTHOGONALIZER;\n        double zz = z * ROOT3OVER3;\n        double xr = x + s2 + zz;\n        double yr = y + s2 + zz;\n        double zr = xy * -ROOT3OVER3 + zz;\n\n        // Evaluate both lattices to form a BCC lattice.\n        return Noise3_UnrotatedBase(seed, xr, yr, zr);\n    }\n\n    /**\n     * 3D OpenSimplex2 noise, with better visual isotropy in (X, Z).\n     * Recommended for 3D terrain and time-varied animations.\n     * The Y coordinate should always be the \"different\" coordinate in whatever your use case is.\n     * If Y is vertical in world coordinates, call Noise3_ImproveXZ(x, Y, z).\n     * If Z is vertical in world coordinates, call Noise3_ImproveXZ(x, Z, y) or use Noise3_ImproveXY.\n     * For a time varied animation, call Noise3_ImproveXZ(x, T, y) or use Noise3_ImproveXY.\n     */\n    public static float Noise3_ImproveXZ(long seed, double x, double y, double z)\n    {\n        // Re-orient the cubic lattices without skewing, so Y points up the main lattice diagonal,\n        // and the planes formed by XZ are moved far out of alignment with the cube faces.\n        // Orthonormal rotation. Not a skew transform.\n        double xz = x + z;\n        double s2 = xz * ROTATE_3D_ORTHOGONALIZER;\n        double yy = y * ROOT3OVER3;\n        double xr = x + s2 + yy;\n        double zr = z + s2 + yy;\n        double yr = xz * -ROOT3OVER3 + yy;\n\n        // Evaluate both lattices to form a BCC lattice.\n        return Noise3_UnrotatedBase(seed, xr, yr, zr);\n    }\n\n    /**\n     * 3D OpenSimplex2 noise, fallback rotation option\n     * Use Noise3_ImproveXY or Noise3_ImproveXZ instead, wherever appropriate.\n     * They have less diagonal bias. This function's best use is as a fallback.\n     */\n    public static float Noise3_Fallback(long seed, double x, double y, double z)\n    {\n        // Re-orient the cubic lattices via rotation, to produce a familiar look.\n        // Orthonormal rotation. Not a skew transform.\n        double r = FALLBACK_ROTATE_3D * (x + y + z);\n        double xr = r - x, yr = r - y, zr = r - z;\n\n        // Evaluate both lattices to form a BCC lattice.\n        return Noise3_UnrotatedBase(seed, xr, yr, zr);\n    }\n\n    /**\n     * Generate overlapping cubic lattices for 3D OpenSimplex2 noise.\n     */\n    private static float Noise3_UnrotatedBase(long seed, double xr, double yr, double zr)\n    {\n        // Get base points and offsets.\n        int xrb = FastRound(xr), yrb = FastRound(yr), zrb = FastRound(zr);\n        float xri = (float)(xr - xrb), yri = (float)(yr - yrb), zri = (float)(zr - zrb);\n\n        // -1 if positive, 1 if negative.\n        int xNSign = (int)(-1.0f - xri) | 1, yNSign = (int)(-1.0f - yri) | 1, zNSign = (int)(-1.0f - zri) | 1;\n\n        // Compute absolute values, using the above as a shortcut. This was faster in my tests for some reason.\n        float ax0 = xNSign * -xri, ay0 = yNSign * -yri, az0 = zNSign * -zri;\n\n        // Prime pre-multiplication for hash.\n        long xrbp = xrb * PRIME_X, yrbp = yrb * PRIME_Y, zrbp = zrb * PRIME_Z;\n\n        // Loop: Pick an edge on each lattice copy.\n        float value = 0;\n        float a = (RSQUARED_3D - xri * xri) - (yri * yri + zri * zri);\n        for (int l = 0; ; l++)\n        {\n\n            // Closest point on cube.\n            if (a > 0)\n            {\n                value += (a * a) * (a * a) * Grad(seed, xrbp, yrbp, zrbp, xri, yri, zri);\n            }\n\n            // Second-closest point.\n            if (ax0 >= ay0 && ax0 >= az0)\n            {\n                float b = a + ax0 + ax0;\n                if (b > 1)\n                {\n                    b -= 1;\n                    value += (b * b) * (b * b) * Grad(seed, xrbp - xNSign * PRIME_X, yrbp, zrbp, xri + xNSign, yri, zri);\n                }\n            }\n            else if (ay0 > ax0 && ay0 >= az0)\n            {\n                float b = a + ay0 + ay0;\n                if (b > 1)\n                {\n                    b -= 1;\n                    value += (b * b) * (b * b) * Grad(seed, xrbp, yrbp - yNSign * PRIME_Y, zrbp, xri, yri + yNSign, zri);\n                }\n            }\n            else\n            {\n                float b = a + az0 + az0;\n                if (b > 1)\n                {\n                    b -= 1;\n                    value += (b * b) * (b * b) * Grad(seed, xrbp, yrbp, zrbp - zNSign * PRIME_Z, xri, yri, zri + zNSign);\n                }\n            }\n\n            // Break from loop if we're done, skipping updates below.\n            if (l == 1) break;\n\n            // Update absolute value.\n            ax0 = 0.5f - ax0;\n            ay0 = 0.5f - ay0;\n            az0 = 0.5f - az0;\n\n            // Update relative coordinate.\n            xri = xNSign * ax0;\n            yri = yNSign * ay0;\n            zri = zNSign * az0;\n\n            // Update falloff.\n            a += (0.75f - ax0) - (ay0 + az0);\n\n            // Update prime for hash.\n            xrbp += (xNSign >> 1) & PRIME_X;\n            yrbp += (yNSign >> 1) & PRIME_Y;\n            zrbp += (zNSign >> 1) & PRIME_Z;\n\n            // Update the reverse sign indicators.\n            xNSign = -xNSign;\n            yNSign = -yNSign;\n            zNSign = -zNSign;\n\n            // And finally update the seed for the other lattice copy.\n            seed ^= SEED_FLIP_3D;\n        }\n\n        return value;\n    }\n\n    /**\n     * 4D OpenSimplex2 noise, with XYZ oriented like Noise3_ImproveXY\n     * and W for an extra degree of freedom. W repeats eventually.\n     * Recommended for time-varied animations which texture a 3D object (W=time)\n     * in a space where Z is vertical\n     */\n    public static float Noise4_ImproveXYZ_ImproveXY(long seed, double x, double y, double z, double w)\n    {\n        double xy = x + y;\n        double s2 = xy * -0.21132486540518699998;\n        double zz = z * 0.28867513459481294226;\n        double ww = w * 0.2236067977499788;\n        double xr = x + (zz + ww + s2), yr = y + (zz + ww + s2);\n        double zr = xy * -0.57735026918962599998 + (zz + ww);\n        double wr = z * -0.866025403784439 + ww;\n\n        return Noise4_UnskewedBase(seed, xr, yr, zr, wr);\n    }\n\n    /**\n     * 4D OpenSimplex2 noise, with XYZ oriented like Noise3_ImproveXZ\n     * and W for an extra degree of freedom. W repeats eventually.\n     * Recommended for time-varied animations which texture a 3D object (W=time)\n     * in a space where Y is vertical\n     */\n    public static float Noise4_ImproveXYZ_ImproveXZ(long seed, double x, double y, double z, double w)\n    {\n        double xz = x + z;\n        double s2 = xz * -0.21132486540518699998;\n        double yy = y * 0.28867513459481294226;\n        double ww = w * 0.2236067977499788;\n        double xr = x + (yy + ww + s2), zr = z + (yy + ww + s2);\n        double yr = xz * -0.57735026918962599998 + (yy + ww);\n        double wr = y * -0.866025403784439 + ww;\n\n        return Noise4_UnskewedBase(seed, xr, yr, zr, wr);\n    }\n\n    /**\n     * 4D OpenSimplex2 noise, with XYZ oriented like Noise3_Fallback\n     * and W for an extra degree of freedom. W repeats eventually.\n     * Recommended for time-varied animations which texture a 3D object (W=time)\n     * where there isn't a clear distinction between horizontal and vertical\n     */\n    public static float Noise4_ImproveXYZ(long seed, double x, double y, double z, double w)\n    {\n        double xyz = x + y + z;\n        double ww = w * 0.2236067977499788;\n        double s2 = xyz * -0.16666666666666666 + ww;\n        double xs = x + s2, ys = y + s2, zs = z + s2, ws = -0.5 * xyz + ww;\n\n        return Noise4_UnskewedBase(seed, xs, ys, zs, ws);\n    }\n\n    /**\n     * 4D OpenSimplex2 noise, fallback lattice orientation.\n     */\n    public static float Noise4_Fallback(long seed, double x, double y, double z, double w)\n    {\n        // Get points for A4 lattice\n        double s = SKEW_4D * (x + y + z + w);\n        double xs = x + s, ys = y + s, zs = z + s, ws = w + s;\n\n        return Noise4_UnskewedBase(seed, xs, ys, zs, ws);\n    }\n\n    /**\n    * 4D OpenSimplex2 noise base.\n    */\n    private static float Noise4_UnskewedBase(long seed, double xs, double ys, double zs, double ws)\n    {\n        // Get base points and offsets\n        int xsb = FastFloor(xs), ysb = FastFloor(ys), zsb = FastFloor(zs), wsb = FastFloor(ws);\n        float xsi = (float)(xs - xsb), ysi = (float)(ys - ysb), zsi = (float)(zs - zsb), wsi = (float)(ws - wsb);\n\n        // Determine which lattice we can be confident has a contributing point its corresponding cell's base simplex.\n        // We only look at the spaces between the diagonal planes. This proved effective in all of my tests.\n        float siSum = (xsi + ysi) + (zsi + wsi);\n        int startingLattice = (int)(siSum * 1.25);\n\n        // Offset for seed based on first lattice copy.\n        seed += startingLattice * SEED_OFFSET_4D;\n\n        // Offset for lattice point relative positions (skewed)\n        float startingLatticeOffset = startingLattice * -LATTICE_STEP_4D;\n        xsi += startingLatticeOffset; ysi += startingLatticeOffset; zsi += startingLatticeOffset; wsi += startingLatticeOffset;\n\n        // Prep for vertex contributions.\n        float ssi = (siSum + startingLatticeOffset * 4) * UNSKEW_4D;\n        \n        // Prime pre-multiplication for hash.\n        long xsvp = xsb * PRIME_X, ysvp = ysb * PRIME_Y, zsvp = zsb * PRIME_Z, wsvp = wsb * PRIME_W;\n\n        // Five points to add, total, from five copies of the A4 lattice.\n        float value = 0;\n        for (int i = 0; ; i++)\n        {\n\n            // Next point is the closest vertex on the 4-simplex whose base vertex is the aforementioned vertex.\n            double score0 = 1.0 + ssi * (-1.0 / UNSKEW_4D); // Seems slightly faster than 1.0-xsi-ysi-zsi-wsi\n            if (xsi >= ysi && xsi >= zsi && xsi >= wsi && xsi >= score0)\n            {\n                xsvp += PRIME_X;\n                xsi -= 1;\n                ssi -= UNSKEW_4D;\n            }\n            else if (ysi > xsi && ysi >= zsi && ysi >= wsi && ysi >= score0)\n            {\n                ysvp += PRIME_Y;\n                ysi -= 1;\n                ssi -= UNSKEW_4D;\n            }\n            else if (zsi > xsi && zsi > ysi && zsi >= wsi && zsi >= score0)\n            {\n                zsvp += PRIME_Z;\n                zsi -= 1;\n                ssi -= UNSKEW_4D;\n            }\n            else if (wsi > xsi && wsi > ysi && wsi > zsi && wsi >= score0)\n            {\n                wsvp += PRIME_W;\n                wsi -= 1;\n                ssi -= UNSKEW_4D;\n            }\n\n            // Gradient contribution with falloff.\n            float dx = xsi + ssi, dy = ysi + ssi, dz = zsi + ssi, dw = wsi + ssi;\n            float a = (dx * dx + dy * dy) + (dz * dz + dw * dw);\n            if (a < RSQUARED_4D)\n            {\n                a -= RSQUARED_4D;\n                a *= a;\n                value += a * a * Grad(seed, xsvp, ysvp, zsvp, wsvp, dx, dy, dz, dw);\n            }\n\n            // Break from loop if we're done, skipping updates below.\n            if (i == 4) break;\n\n            // Update for next lattice copy shifted down by <-0.2, -0.2, -0.2, -0.2>.\n            xsi += LATTICE_STEP_4D; ysi += LATTICE_STEP_4D; zsi += LATTICE_STEP_4D; wsi += LATTICE_STEP_4D;\n            ssi += LATTICE_STEP_4D * 4 * UNSKEW_4D;\n            seed -= SEED_OFFSET_4D;\n\n            // Because we don't always start on the same lattice copy, there's a special reset case.\n            if (i == startingLattice)\n            {\n                xsvp -= PRIME_X;\n                ysvp -= PRIME_Y;\n                zsvp -= PRIME_Z;\n                wsvp -= PRIME_W;\n                seed += SEED_OFFSET_4D * 5;\n            }\n        }\n\n        return value;\n    }\n\n    /*\n     * Utility\n     */\n\n    [MethodImpl(MethodImplOptions.AggressiveInlining)]\n    private static float Grad(long seed, long xsvp, long ysvp, float dx, float dy)\n    {\n        long hash = seed ^ xsvp ^ ysvp;\n        hash *= HASH_MULTIPLIER;\n        hash ^= hash >> (64 - N_GRADS_2D_EXPONENT + 1);\n        int gi = (int)hash & ((N_GRADS_2D - 1) << 1);\n        return GRADIENTS_2D[gi | 0] * dx + GRADIENTS_2D[gi | 1] * dy;\n    }\n\n    [MethodImpl(MethodImplOptions.AggressiveInlining)]\n    private static float Grad(long seed, long xrvp, long yrvp, long zrvp, float dx, float dy, float dz)\n    {\n        long hash = (seed ^ xrvp) ^ (yrvp ^ zrvp);\n        hash *= HASH_MULTIPLIER;\n        hash ^= hash >> (64 - N_GRADS_3D_EXPONENT + 2);\n        int gi = (int)hash & ((N_GRADS_3D - 1) << 2);\n        return GRADIENTS_3D[gi | 0] * dx + GRADIENTS_3D[gi | 1] * dy + GRADIENTS_3D[gi | 2] * dz;\n    }\n\n    [MethodImpl(MethodImplOptions.AggressiveInlining)]\n    private static float Grad(long seed, long xsvp, long ysvp, long zsvp, long wsvp, float dx, float dy, float dz, float dw)\n    {\n        long hash = seed ^ (xsvp ^ ysvp) ^ (zsvp ^ wsvp);\n        hash *= HASH_MULTIPLIER;\n        hash ^= hash >> (64 - N_GRADS_4D_EXPONENT + 2);\n        int gi = (int)hash & ((N_GRADS_4D - 1) << 2);\n        return (GRADIENTS_4D[gi | 0] * dx + GRADIENTS_4D[gi | 1] * dy) + (GRADIENTS_4D[gi | 2] * dz + GRADIENTS_4D[gi | 3] * dw);\n    }\n\n    [MethodImpl(MethodImplOptions.AggressiveInlining)]\n    private static int FastFloor(double x)\n    {\n        int xi = (int)x;\n        return x < xi ? xi - 1 : xi;\n    }\n\n    [MethodImpl(MethodImplOptions.AggressiveInlining)]\n    private static int FastRound(double x)\n    {\n        return x < 0 ? (int)(x - 0.5) : (int)(x + 0.5);\n    }\n\n    /*\n     * Gradients\n     */\n\n    private static readonly float[] GRADIENTS_2D;\n    private static readonly float[] GRADIENTS_3D;\n    private static readonly float[] GRADIENTS_4D;\n    static OpenSimplex2()\n    {\n\n        GRADIENTS_2D = new float[N_GRADS_2D * 2];\n        float[] grad2 = {\n             0.38268343236509f,   0.923879532511287f,\n             0.923879532511287f,  0.38268343236509f,\n             0.923879532511287f, -0.38268343236509f,\n             0.38268343236509f,  -0.923879532511287f,\n            -0.38268343236509f,  -0.923879532511287f,\n            -0.923879532511287f, -0.38268343236509f,\n            -0.923879532511287f,  0.38268343236509f,\n            -0.38268343236509f,   0.923879532511287f,\n            //-------------------------------------//\n             0.130526192220052f,  0.99144486137381f,\n             0.608761429008721f,  0.793353340291235f,\n             0.793353340291235f,  0.608761429008721f,\n             0.99144486137381f,   0.130526192220051f,\n             0.99144486137381f,  -0.130526192220051f,\n             0.793353340291235f, -0.60876142900872f,\n             0.608761429008721f, -0.793353340291235f,\n             0.130526192220052f, -0.99144486137381f,\n            -0.130526192220052f, -0.99144486137381f,\n            -0.608761429008721f, -0.793353340291235f,\n            -0.793353340291235f, -0.608761429008721f,\n            -0.99144486137381f,  -0.130526192220052f,\n            -0.99144486137381f,   0.130526192220051f,\n            -0.793353340291235f,  0.608761429008721f,\n            -0.608761429008721f,  0.793353340291235f,\n            -0.130526192220052f,  0.99144486137381f,\n        };\n        for (int i = 0; i < grad2.Length; i++)\n        {\n            grad2[i] = (float)(grad2[i] / NORMALIZER_2D);\n        }\n        for (int i = 0, j = 0; i < GRADIENTS_2D.Length; i++, j++)\n        {\n            if (j == grad2.Length) j = 0;\n            GRADIENTS_2D[i] = grad2[j];\n        }\n\n        GRADIENTS_3D = new float[N_GRADS_3D * 4];\n        float[] grad3 = {\n             2.22474487139f,       2.22474487139f,      -1.0f,                 0.0f,\n             2.22474487139f,       2.22474487139f,       1.0f,                 0.0f,\n             3.0862664687972017f,  1.1721513422464978f,  0.0f,                 0.0f,\n             1.1721513422464978f,  3.0862664687972017f,  0.0f,                 0.0f,\n            -2.22474487139f,       2.22474487139f,      -1.0f,                 0.0f,\n            -2.22474487139f,       2.22474487139f,       1.0f,                 0.0f,\n            -1.1721513422464978f,  3.0862664687972017f,  0.0f,                 0.0f,\n            -3.0862664687972017f,  1.1721513422464978f,  0.0f,                 0.0f,\n            -1.0f,                -2.22474487139f,      -2.22474487139f,       0.0f,\n             1.0f,                -2.22474487139f,      -2.22474487139f,       0.0f,\n             0.0f,                -3.0862664687972017f, -1.1721513422464978f,  0.0f,\n             0.0f,                -1.1721513422464978f, -3.0862664687972017f,  0.0f,\n            -1.0f,                -2.22474487139f,       2.22474487139f,       0.0f,\n             1.0f,                -2.22474487139f,       2.22474487139f,       0.0f,\n             0.0f,                -1.1721513422464978f,  3.0862664687972017f,  0.0f,\n             0.0f,                -3.0862664687972017f,  1.1721513422464978f,  0.0f,\n            //--------------------------------------------------------------------//\n            -2.22474487139f,      -2.22474487139f,      -1.0f,                 0.0f,\n            -2.22474487139f,      -2.22474487139f,       1.0f,                 0.0f,\n            -3.0862664687972017f, -1.1721513422464978f,  0.0f,                 0.0f,\n            -1.1721513422464978f, -3.0862664687972017f,  0.0f,                 0.0f,\n            -2.22474487139f,      -1.0f,                -2.22474487139f,       0.0f,\n            -2.22474487139f,       1.0f,                -2.22474487139f,       0.0f,\n            -1.1721513422464978f,  0.0f,                -3.0862664687972017f,  0.0f,\n            -3.0862664687972017f,  0.0f,                -1.1721513422464978f,  0.0f,\n            -2.22474487139f,      -1.0f,                 2.22474487139f,       0.0f,\n            -2.22474487139f,       1.0f,                 2.22474487139f,       0.0f,\n            -3.0862664687972017f,  0.0f,                 1.1721513422464978f,  0.0f,\n            -1.1721513422464978f,  0.0f,                 3.0862664687972017f,  0.0f,\n            -1.0f,                 2.22474487139f,      -2.22474487139f,       0.0f,\n             1.0f,                 2.22474487139f,      -2.22474487139f,       0.0f,\n             0.0f,                 1.1721513422464978f, -3.0862664687972017f,  0.0f,\n             0.0f,                 3.0862664687972017f, -1.1721513422464978f,  0.0f,\n            -1.0f,                 2.22474487139f,       2.22474487139f,       0.0f,\n             1.0f,                 2.22474487139f,       2.22474487139f,       0.0f,\n             0.0f,                 3.0862664687972017f,  1.1721513422464978f,  0.0f,\n             0.0f,                 1.1721513422464978f,  3.0862664687972017f,  0.0f,\n             2.22474487139f,      -2.22474487139f,      -1.0f,                 0.0f,\n             2.22474487139f,      -2.22474487139f,       1.0f,                 0.0f,\n             1.1721513422464978f, -3.0862664687972017f,  0.0f,                 0.0f,\n             3.0862664687972017f, -1.1721513422464978f,  0.0f,                 0.0f,\n             2.22474487139f,      -1.0f,                -2.22474487139f,       0.0f,\n             2.22474487139f,       1.0f,                -2.22474487139f,       0.0f,\n             3.0862664687972017f,  0.0f,                -1.1721513422464978f,  0.0f,\n             1.1721513422464978f,  0.0f,                -3.0862664687972017f,  0.0f,\n             2.22474487139f,      -1.0f,                 2.22474487139f,       0.0f,\n             2.22474487139f,       1.0f,                 2.22474487139f,       0.0f,\n             1.1721513422464978f,  0.0f,                 3.0862664687972017f,  0.0f,\n             3.0862664687972017f,  0.0f,                 1.1721513422464978f,  0.0f,\n        };\n        for (int i = 0; i < grad3.Length; i++)\n        {\n            grad3[i] = (float)(grad3[i] / NORMALIZER_3D);\n        }\n        for (int i = 0, j = 0; i < GRADIENTS_3D.Length; i++, j++)\n        {\n            if (j == grad3.Length) j = 0;\n            GRADIENTS_3D[i] = grad3[j];\n        }\n\n        GRADIENTS_4D = new float[N_GRADS_4D * 4];\n        float[] grad4 = {\n            -0.6740059517812944f,   -0.3239847771997537f,   -0.3239847771997537f,    0.5794684678643381f,\n            -0.7504883828755602f,   -0.4004672082940195f,    0.15296486218853164f,   0.5029860367700724f,\n            -0.7504883828755602f,    0.15296486218853164f,  -0.4004672082940195f,    0.5029860367700724f,\n            -0.8828161875373585f,    0.08164729285680945f,   0.08164729285680945f,   0.4553054119602712f,\n            -0.4553054119602712f,   -0.08164729285680945f,  -0.08164729285680945f,   0.8828161875373585f,\n            -0.5029860367700724f,   -0.15296486218853164f,   0.4004672082940195f,    0.7504883828755602f,\n            -0.5029860367700724f,    0.4004672082940195f,   -0.15296486218853164f,   0.7504883828755602f,\n            -0.5794684678643381f,    0.3239847771997537f,    0.3239847771997537f,    0.6740059517812944f,\n            -0.6740059517812944f,   -0.3239847771997537f,    0.5794684678643381f,   -0.3239847771997537f,\n            -0.7504883828755602f,   -0.4004672082940195f,    0.5029860367700724f,    0.15296486218853164f,\n            -0.7504883828755602f,    0.15296486218853164f,   0.5029860367700724f,   -0.4004672082940195f,\n            -0.8828161875373585f,    0.08164729285680945f,   0.4553054119602712f,    0.08164729285680945f,\n            -0.4553054119602712f,   -0.08164729285680945f,   0.8828161875373585f,   -0.08164729285680945f,\n            -0.5029860367700724f,   -0.15296486218853164f,   0.7504883828755602f,    0.4004672082940195f,\n            -0.5029860367700724f,    0.4004672082940195f,    0.7504883828755602f,   -0.15296486218853164f,\n            -0.5794684678643381f,    0.3239847771997537f,    0.6740059517812944f,    0.3239847771997537f,\n            -0.6740059517812944f,    0.5794684678643381f,   -0.3239847771997537f,   -0.3239847771997537f,\n            -0.7504883828755602f,    0.5029860367700724f,   -0.4004672082940195f,    0.15296486218853164f,\n            -0.7504883828755602f,    0.5029860367700724f,    0.15296486218853164f,  -0.4004672082940195f,\n            -0.8828161875373585f,    0.4553054119602712f,    0.08164729285680945f,   0.08164729285680945f,\n            -0.4553054119602712f,    0.8828161875373585f,   -0.08164729285680945f,  -0.08164729285680945f,\n            -0.5029860367700724f,    0.7504883828755602f,   -0.15296486218853164f,   0.4004672082940195f,\n            -0.5029860367700724f,    0.7504883828755602f,    0.4004672082940195f,   -0.15296486218853164f,\n            -0.5794684678643381f,    0.6740059517812944f,    0.3239847771997537f,    0.3239847771997537f,\n             0.5794684678643381f,   -0.6740059517812944f,   -0.3239847771997537f,   -0.3239847771997537f,\n             0.5029860367700724f,   -0.7504883828755602f,   -0.4004672082940195f,    0.15296486218853164f,\n             0.5029860367700724f,   -0.7504883828755602f,    0.15296486218853164f,  -0.4004672082940195f,\n             0.4553054119602712f,   -0.8828161875373585f,    0.08164729285680945f,   0.08164729285680945f,\n             0.8828161875373585f,   -0.4553054119602712f,   -0.08164729285680945f,  -0.08164729285680945f,\n             0.7504883828755602f,   -0.5029860367700724f,   -0.15296486218853164f,   0.4004672082940195f,\n             0.7504883828755602f,   -0.5029860367700724f,    0.4004672082940195f,   -0.15296486218853164f,\n             0.6740059517812944f,   -0.5794684678643381f,    0.3239847771997537f,    0.3239847771997537f,\n            //------------------------------------------------------------------------------------------//\n            -0.753341017856078f,    -0.37968289875261624f,  -0.37968289875261624f,  -0.37968289875261624f,\n            -0.7821684431180708f,   -0.4321472685365301f,   -0.4321472685365301f,    0.12128480194602098f,\n            -0.7821684431180708f,   -0.4321472685365301f,    0.12128480194602098f,  -0.4321472685365301f,\n            -0.7821684431180708f,    0.12128480194602098f,  -0.4321472685365301f,   -0.4321472685365301f,\n            -0.8586508742123365f,   -0.508629699630796f,     0.044802370851755174f,  0.044802370851755174f,\n            -0.8586508742123365f,    0.044802370851755174f, -0.508629699630796f,     0.044802370851755174f,\n            -0.8586508742123365f,    0.044802370851755174f,  0.044802370851755174f, -0.508629699630796f,\n            -0.9982828964265062f,   -0.03381941603233842f,  -0.03381941603233842f,  -0.03381941603233842f,\n            -0.37968289875261624f,  -0.753341017856078f,    -0.37968289875261624f,  -0.37968289875261624f,\n            -0.4321472685365301f,   -0.7821684431180708f,   -0.4321472685365301f,    0.12128480194602098f,\n            -0.4321472685365301f,   -0.7821684431180708f,    0.12128480194602098f,  -0.4321472685365301f,\n             0.12128480194602098f,  -0.7821684431180708f,   -0.4321472685365301f,   -0.4321472685365301f,\n            -0.508629699630796f,    -0.8586508742123365f,    0.044802370851755174f,  0.044802370851755174f,\n             0.044802370851755174f, -0.8586508742123365f,   -0.508629699630796f,     0.044802370851755174f,\n             0.044802370851755174f, -0.8586508742123365f,    0.044802370851755174f, -0.508629699630796f,\n            -0.03381941603233842f,  -0.9982828964265062f,   -0.03381941603233842f,  -0.03381941603233842f,\n            -0.37968289875261624f,  -0.37968289875261624f,  -0.753341017856078f,    -0.37968289875261624f,\n            -0.4321472685365301f,   -0.4321472685365301f,   -0.7821684431180708f,    0.12128480194602098f,\n            -0.4321472685365301f,    0.12128480194602098f,  -0.7821684431180708f,   -0.4321472685365301f,\n             0.12128480194602098f,  -0.4321472685365301f,   -0.7821684431180708f,   -0.4321472685365301f,\n            -0.508629699630796f,     0.044802370851755174f, -0.8586508742123365f,    0.044802370851755174f,\n             0.044802370851755174f, -0.508629699630796f,    -0.8586508742123365f,    0.044802370851755174f,\n             0.044802370851755174f,  0.044802370851755174f, -0.8586508742123365f,   -0.508629699630796f,\n            -0.03381941603233842f,  -0.03381941603233842f,  -0.9982828964265062f,   -0.03381941603233842f,\n            -0.37968289875261624f,  -0.37968289875261624f,  -0.37968289875261624f,  -0.753341017856078f,\n            -0.4321472685365301f,   -0.4321472685365301f,    0.12128480194602098f,  -0.7821684431180708f,\n            -0.4321472685365301f,    0.12128480194602098f,  -0.4321472685365301f,   -0.7821684431180708f,\n             0.12128480194602098f,  -0.4321472685365301f,   -0.4321472685365301f,   -0.7821684431180708f,\n            -0.508629699630796f,     0.044802370851755174f,  0.044802370851755174f, -0.8586508742123365f,\n             0.044802370851755174f, -0.508629699630796f,     0.044802370851755174f, -0.8586508742123365f,\n             0.044802370851755174f,  0.044802370851755174f, -0.508629699630796f,    -0.8586508742123365f,\n            -0.03381941603233842f,  -0.03381941603233842f,  -0.03381941603233842f,  -0.9982828964265062f,\n            -0.3239847771997537f,   -0.6740059517812944f,   -0.3239847771997537f,    0.5794684678643381f,\n            -0.4004672082940195f,   -0.7504883828755602f,    0.15296486218853164f,   0.5029860367700724f,\n             0.15296486218853164f,  -0.7504883828755602f,   -0.4004672082940195f,    0.5029860367700724f,\n             0.08164729285680945f,  -0.8828161875373585f,    0.08164729285680945f,   0.4553054119602712f,\n            -0.08164729285680945f,  -0.4553054119602712f,   -0.08164729285680945f,   0.8828161875373585f,\n            -0.15296486218853164f,  -0.5029860367700724f,    0.4004672082940195f,    0.7504883828755602f,\n             0.4004672082940195f,   -0.5029860367700724f,   -0.15296486218853164f,   0.7504883828755602f,\n             0.3239847771997537f,   -0.5794684678643381f,    0.3239847771997537f,    0.6740059517812944f,\n            -0.3239847771997537f,   -0.3239847771997537f,   -0.6740059517812944f,    0.5794684678643381f,\n            -0.4004672082940195f,    0.15296486218853164f,  -0.7504883828755602f,    0.5029860367700724f,\n             0.15296486218853164f,  -0.4004672082940195f,   -0.7504883828755602f,    0.5029860367700724f,\n             0.08164729285680945f,   0.08164729285680945f,  -0.8828161875373585f,    0.4553054119602712f,\n            -0.08164729285680945f,  -0.08164729285680945f,  -0.4553054119602712f,    0.8828161875373585f,\n            -0.15296486218853164f,   0.4004672082940195f,   -0.5029860367700724f,    0.7504883828755602f,\n             0.4004672082940195f,   -0.15296486218853164f,  -0.5029860367700724f,    0.7504883828755602f,\n             0.3239847771997537f,    0.3239847771997537f,   -0.5794684678643381f,    0.6740059517812944f,\n            -0.3239847771997537f,   -0.6740059517812944f,    0.5794684678643381f,   -0.3239847771997537f,\n            -0.4004672082940195f,   -0.7504883828755602f,    0.5029860367700724f,    0.15296486218853164f,\n             0.15296486218853164f,  -0.7504883828755602f,    0.5029860367700724f,   -0.4004672082940195f,\n             0.08164729285680945f,  -0.8828161875373585f,    0.4553054119602712f,    0.08164729285680945f,\n            -0.08164729285680945f,  -0.4553054119602712f,    0.8828161875373585f,   -0.08164729285680945f,\n            -0.15296486218853164f,  -0.5029860367700724f,    0.7504883828755602f,    0.4004672082940195f,\n             0.4004672082940195f,   -0.5029860367700724f,    0.7504883828755602f,   -0.15296486218853164f,\n             0.3239847771997537f,   -0.5794684678643381f,    0.6740059517812944f,    0.3239847771997537f,\n            -0.3239847771997537f,   -0.3239847771997537f,    0.5794684678643381f,   -0.6740059517812944f,\n            -0.4004672082940195f,    0.15296486218853164f,   0.5029860367700724f,   -0.7504883828755602f,\n             0.15296486218853164f,  -0.4004672082940195f,    0.5029860367700724f,   -0.7504883828755602f,\n             0.08164729285680945f,   0.08164729285680945f,   0.4553054119602712f,   -0.8828161875373585f,\n            -0.08164729285680945f,  -0.08164729285680945f,   0.8828161875373585f,   -0.4553054119602712f,\n            -0.15296486218853164f,   0.4004672082940195f,    0.7504883828755602f,   -0.5029860367700724f,\n             0.4004672082940195f,   -0.15296486218853164f,   0.7504883828755602f,   -0.5029860367700724f,\n             0.3239847771997537f,    0.3239847771997537f,    0.6740059517812944f,   -0.5794684678643381f,\n            -0.3239847771997537f,    0.5794684678643381f,   -0.6740059517812944f,   -0.3239847771997537f,\n            -0.4004672082940195f,    0.5029860367700724f,   -0.7504883828755602f,    0.15296486218853164f,\n             0.15296486218853164f,   0.5029860367700724f,   -0.7504883828755602f,   -0.4004672082940195f,\n             0.08164729285680945f,   0.4553054119602712f,   -0.8828161875373585f,    0.08164729285680945f,\n            -0.08164729285680945f,   0.8828161875373585f,   -0.4553054119602712f,   -0.08164729285680945f,\n            -0.15296486218853164f,   0.7504883828755602f,   -0.5029860367700724f,    0.4004672082940195f,\n             0.4004672082940195f,    0.7504883828755602f,   -0.5029860367700724f,   -0.15296486218853164f,\n             0.3239847771997537f,    0.6740059517812944f,   -0.5794684678643381f,    0.3239847771997537f,\n            -0.3239847771997537f,    0.5794684678643381f,   -0.3239847771997537f,   -0.6740059517812944f,\n            -0.4004672082940195f,    0.5029860367700724f,    0.15296486218853164f,  -0.7504883828755602f,\n             0.15296486218853164f,   0.5029860367700724f,   -0.4004672082940195f,   -0.7504883828755602f,\n             0.08164729285680945f,   0.4553054119602712f,    0.08164729285680945f,  -0.8828161875373585f,\n            -0.08164729285680945f,   0.8828161875373585f,   -0.08164729285680945f,  -0.4553054119602712f,\n            -0.15296486218853164f,   0.7504883828755602f,    0.4004672082940195f,   -0.5029860367700724f,\n             0.4004672082940195f,    0.7504883828755602f,   -0.15296486218853164f,  -0.5029860367700724f,\n             0.3239847771997537f,    0.6740059517812944f,    0.3239847771997537f,   -0.5794684678643381f,\n             0.5794684678643381f,   -0.3239847771997537f,   -0.6740059517812944f,   -0.3239847771997537f,\n             0.5029860367700724f,   -0.4004672082940195f,   -0.7504883828755602f,    0.15296486218853164f,\n             0.5029860367700724f,    0.15296486218853164f,  -0.7504883828755602f,   -0.4004672082940195f,\n             0.4553054119602712f,    0.08164729285680945f,  -0.8828161875373585f,    0.08164729285680945f,\n             0.8828161875373585f,   -0.08164729285680945f,  -0.4553054119602712f,   -0.08164729285680945f,\n             0.7504883828755602f,   -0.15296486218853164f,  -0.5029860367700724f,    0.4004672082940195f,\n             0.7504883828755602f,    0.4004672082940195f,   -0.5029860367700724f,   -0.15296486218853164f,\n             0.6740059517812944f,    0.3239847771997537f,   -0.5794684678643381f,    0.3239847771997537f,\n             0.5794684678643381f,   -0.3239847771997537f,   -0.3239847771997537f,   -0.6740059517812944f,\n             0.5029860367700724f,   -0.4004672082940195f,    0.15296486218853164f,  -0.7504883828755602f,\n             0.5029860367700724f,    0.15296486218853164f,  -0.4004672082940195f,   -0.7504883828755602f,\n             0.4553054119602712f,    0.08164729285680945f,   0.08164729285680945f,  -0.8828161875373585f,\n             0.8828161875373585f,   -0.08164729285680945f,  -0.08164729285680945f,  -0.4553054119602712f,\n             0.7504883828755602f,   -0.15296486218853164f,   0.4004672082940195f,   -0.5029860367700724f,\n             0.7504883828755602f,    0.4004672082940195f,   -0.15296486218853164f,  -0.5029860367700724f,\n             0.6740059517812944f,    0.3239847771997537f,    0.3239847771997537f,   -0.5794684678643381f,\n             0.03381941603233842f,   0.03381941603233842f,   0.03381941603233842f,   0.9982828964265062f,\n            -0.044802370851755174f, -0.044802370851755174f,  0.508629699630796f,     0.8586508742123365f,\n            -0.044802370851755174f,  0.508629699630796f,    -0.044802370851755174f,  0.8586508742123365f,\n            -0.12128480194602098f,   0.4321472685365301f,    0.4321472685365301f,    0.7821684431180708f,\n             0.508629699630796f,    -0.044802370851755174f, -0.044802370851755174f,  0.8586508742123365f,\n             0.4321472685365301f,   -0.12128480194602098f,   0.4321472685365301f,    0.7821684431180708f,\n             0.4321472685365301f,    0.4321472685365301f,   -0.12128480194602098f,   0.7821684431180708f,\n             0.37968289875261624f,   0.37968289875261624f,   0.37968289875261624f,   0.753341017856078f,\n             0.03381941603233842f,   0.03381941603233842f,   0.9982828964265062f,    0.03381941603233842f,\n            -0.044802370851755174f,  0.044802370851755174f,  0.8586508742123365f,    0.508629699630796f,\n            -0.044802370851755174f,  0.508629699630796f,     0.8586508742123365f,   -0.044802370851755174f,\n            -0.12128480194602098f,   0.4321472685365301f,    0.7821684431180708f,    0.4321472685365301f,\n             0.508629699630796f,    -0.044802370851755174f,  0.8586508742123365f,   -0.044802370851755174f,\n             0.4321472685365301f,   -0.12128480194602098f,   0.7821684431180708f,    0.4321472685365301f,\n             0.4321472685365301f,    0.4321472685365301f,    0.7821684431180708f,   -0.12128480194602098f,\n             0.37968289875261624f,   0.37968289875261624f,   0.753341017856078f,     0.37968289875261624f,\n             0.03381941603233842f,   0.9982828964265062f,    0.03381941603233842f,   0.03381941603233842f,\n            -0.044802370851755174f,  0.8586508742123365f,   -0.044802370851755174f,  0.508629699630796f,\n            -0.044802370851755174f,  0.8586508742123365f,    0.508629699630796f,    -0.044802370851755174f,\n            -0.12128480194602098f,   0.7821684431180708f,    0.4321472685365301f,    0.4321472685365301f,\n             0.508629699630796f,     0.8586508742123365f,   -0.044802370851755174f, -0.044802370851755174f,\n             0.4321472685365301f,    0.7821684431180708f,   -0.12128480194602098f,   0.4321472685365301f,\n             0.4321472685365301f,    0.7821684431180708f,    0.4321472685365301f,   -0.12128480194602098f,\n             0.37968289875261624f,   0.753341017856078f,     0.37968289875261624f,   0.37968289875261624f,\n             0.9982828964265062f,    0.03381941603233842f,   0.03381941603233842f,   0.03381941603233842f,\n             0.8586508742123365f,   -0.044802370851755174f, -0.044802370851755174f,  0.508629699630796f,\n             0.8586508742123365f,   -0.044802370851755174f,  0.508629699630796f,    -0.044802370851755174f,\n             0.7821684431180708f,   -0.12128480194602098f,   0.4321472685365301f,    0.4321472685365301f,\n             0.8586508742123365f,    0.508629699630796f,    -0.044802370851755174f, -0.044802370851755174f,\n             0.7821684431180708f,    0.4321472685365301f,   -0.12128480194602098f,   0.4321472685365301f,\n             0.7821684431180708f,    0.4321472685365301f,    0.4321472685365301f,   -0.12128480194602098f,\n             0.753341017856078f,     0.37968289875261624f,   0.37968289875261624f,   0.37968289875261624f,\n        };\n        for (int i = 0; i < grad4.Length; i++)\n        {\n            grad4[i] = (float)(grad4[i] / NORMALIZER_4D);\n        }\n        for (int i = 0, j = 0; i < GRADIENTS_4D.Length; i++, j++)\n        {\n            if (j == grad4.Length) j = 0;\n            GRADIENTS_4D[i] = grad4[j];\n        }\n    }\n}\n"
  },
  {
    "path": "csharp/OpenSimplex2S.cs",
    "content": "/**\n * K.jpg's OpenSimplex 2, smooth variant (\"SuperSimplex\")\n * \n * Note: Not yet compatible with Unity Burst.\n */\n\nusing System.Runtime.CompilerServices;\n\npublic static class OpenSimplex2S\n{\n    private const long PRIME_X = 0x5205402B9270C86FL;\n    private const long PRIME_Y = 0x598CD327003817B5L;\n    private const long PRIME_Z = 0x5BCC226E9FA0BACBL;\n    private const long PRIME_W = 0x56CC5227E58F554BL;\n    private const long HASH_MULTIPLIER = 0x53A3F72DEEC546F5L;\n    private const long SEED_FLIP_3D = -0x52D547B2E96ED629L;\n\n    private const double ROOT2OVER2 = 0.7071067811865476;\n    private const double SKEW_2D = 0.366025403784439;\n    private const double UNSKEW_2D = -0.21132486540518713;\n\n    private const double ROOT3OVER3 = 0.577350269189626;\n    private const double FALLBACK_ROTATE3 = 2.0 / 3.0;\n    private const double ROTATE3_ORTHOGONALIZER = UNSKEW_2D;\n\n    private const float SKEW_4D = 0.309016994374947f;\n    private const float UNSKEW_4D = -0.138196601125011f;\n\n    private const int N_GRADS_2D_EXPONENT = 7;\n    private const int N_GRADS_3D_EXPONENT = 8;\n    private const int N_GRADS_4D_EXPONENT = 9;\n    private const int N_GRADS_2D = 1 << N_GRADS_2D_EXPONENT;\n    private const int N_GRADS_3D = 1 << N_GRADS_3D_EXPONENT;\n    private const int N_GRADS_4D = 1 << N_GRADS_4D_EXPONENT;\n\n    private const double NORMALIZER_2D = 0.05481866495625118;\n    private const double NORMALIZER_3D = 0.2781926117527186;\n    private const double NORMALIZER_4D = 0.11127401889945551;\n\n    private const float RSQUARED_2D = 2.0f / 3.0f;\n    private const float RSQUARED_3D = 3.0f / 4.0f;\n    private const float RSQUARED_4D = 4.0f / 5.0f;\n\n    /*\n     * Noise Evaluators\n     */\n\n    /**\n     * 2D OpenSimplex2S/SuperSimplex noise, standard lattice orientation.\n     */\n    public static float Noise2(long seed, double x, double y)\n    {\n        // Get points for A2* lattice\n        double s = SKEW_2D * (x + y);\n        double xs = x + s, ys = y + s;\n\n        return Noise2_UnskewedBase(seed, xs, ys);\n    }\n\n    /**\n     * 2D OpenSimplex2S/SuperSimplex noise, with Y pointing down the main diagonal.\n     * Might be better for a 2D sandbox style game, where Y is vertical.\n     * Probably slightly less optimal for heightmaps or continent maps,\n     * unless your map is centered around an equator. It's a slight\n     * difference, but the option is here to make it easy.\n     */\n    public static float Noise2_ImproveX(long seed, double x, double y)\n    {\n        // Skew transform and rotation baked into one.\n        double xx = x * ROOT2OVER2;\n        double yy = y * (ROOT2OVER2 * (1 + 2 * SKEW_2D));\n\n        return Noise2_UnskewedBase(seed, yy + xx, yy - xx);\n    }\n\n    /**\n     * 2D  OpenSimplex2S/SuperSimplex noise base.\n     */\n    private static float Noise2_UnskewedBase(long seed, double xs, double ys)\n    {\n        // Get base points and offsets.\n        int xsb = FastFloor(xs), ysb = FastFloor(ys);\n        float xi = (float)(xs - xsb), yi = (float)(ys - ysb);\n\n        // Prime pre-multiplication for hash.\n        long xsbp = xsb * PRIME_X, ysbp = ysb * PRIME_Y;\n\n        // Unskew.\n        float t = (xi + yi) * (float)UNSKEW_2D;\n        float dx0 = xi + t, dy0 = yi + t;\n\n        // First vertex.\n        float a0 = RSQUARED_2D - dx0 * dx0 - dy0 * dy0;\n        float value = (a0 * a0) * (a0 * a0) * Grad(seed, xsbp, ysbp, dx0, dy0);\n        \n        // Second vertex.\n        float a1 = (float)(2 * (1 + 2 * UNSKEW_2D) * (1 / UNSKEW_2D + 2)) * t + ((float)(-2 * (1 + 2 * UNSKEW_2D) * (1 + 2 * UNSKEW_2D)) + a0);\n        float dx1 = dx0 - (float)(1 + 2 * UNSKEW_2D);\n        float dy1 = dy0 - (float)(1 + 2 * UNSKEW_2D);\n        value += (a1 * a1) * (a1 * a1) * Grad(seed, xsbp + PRIME_X, ysbp + PRIME_Y, dx1, dy1);\n\n        // Third and fourth vertices.\n        // Nested conditionals were faster than compact bit logic/arithmetic.\n        float xmyi = xi - yi;\n        if (t < UNSKEW_2D)\n        {\n            if (xi + xmyi > 1)\n            {\n                float dx2 = dx0 - (float)(3 * UNSKEW_2D + 2);\n                float dy2 = dy0 - (float)(3 * UNSKEW_2D + 1);\n                float a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n                if (a2 > 0)\n                {\n                    value += (a2 * a2) * (a2 * a2) * Grad(seed, xsbp + (PRIME_X << 1), ysbp + PRIME_Y, dx2, dy2);\n                }\n            }\n            else\n            {\n                float dx2 = dx0 - (float)UNSKEW_2D;\n                float dy2 = dy0 - (float)(UNSKEW_2D + 1);\n                float a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n                if (a2 > 0)\n                {\n                    value += (a2 * a2) * (a2 * a2) * Grad(seed, xsbp, ysbp + PRIME_Y, dx2, dy2);\n                }\n            }\n\n            if (yi - xmyi > 1)\n            {\n                float dx3 = dx0 - (float)(3 * UNSKEW_2D + 1);\n                float dy3 = dy0 - (float)(3 * UNSKEW_2D + 2);\n                float a3 = RSQUARED_2D - dx3 * dx3 - dy3 * dy3;\n                if (a3 > 0)\n                {\n                    value += (a3 * a3) * (a3 * a3) * Grad(seed, xsbp + PRIME_X, ysbp + (PRIME_Y << 1), dx3, dy3);\n                }\n            }\n            else\n            {\n                float dx3 = dx0 - (float)(UNSKEW_2D + 1);\n                float dy3 = dy0 - (float)UNSKEW_2D;\n                float a3 = RSQUARED_2D - dx3 * dx3 - dy3 * dy3;\n                if (a3 > 0)\n                {\n                    value += (a3 * a3) * (a3 * a3) * Grad(seed, xsbp + PRIME_X, ysbp, dx3, dy3);\n                }\n            }\n        }\n        else\n        {\n            if (xi + xmyi < 0)\n            {\n                float dx2 = dx0 + (float)(1 + UNSKEW_2D);\n                float dy2 = dy0 + (float)UNSKEW_2D;\n                float a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n                if (a2 > 0)\n                {\n                    value += (a2 * a2) * (a2 * a2) * Grad(seed, xsbp - PRIME_X, ysbp, dx2, dy2);\n                }\n            }\n            else\n            {\n                float dx2 = dx0 - (float)(UNSKEW_2D + 1);\n                float dy2 = dy0 - (float)UNSKEW_2D;\n                float a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n                if (a2 > 0)\n                {\n                    value += (a2 * a2) * (a2 * a2) * Grad(seed, xsbp + PRIME_X, ysbp, dx2, dy2);\n                }\n            }\n\n            if (yi < xmyi)\n            {\n                float dx2 = dx0 + (float)UNSKEW_2D;\n                float dy2 = dy0 + (float)(UNSKEW_2D + 1);\n                float a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n                if (a2 > 0)\n                {\n                    value += (a2 * a2) * (a2 * a2) * Grad(seed, xsbp, ysbp - PRIME_Y, dx2, dy2);\n                }\n            }\n            else\n            {\n                float dx2 = dx0 - (float)UNSKEW_2D;\n                float dy2 = dy0 - (float)(UNSKEW_2D + 1);\n                float a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n                if (a2 > 0)\n                {\n                    value += (a2 * a2) * (a2 * a2) * Grad(seed, xsbp, ysbp + PRIME_Y, dx2, dy2);\n                }\n            }\n        }\n\n        return value;\n    }\n\n    /**\n     * 3D OpenSimplex2S/SuperSimplex noise, with better visual isotropy in (X, Y).\n     * Recommended for 3D terrain and time-varied animations.\n     * The Z coordinate should always be the \"different\" coordinate in whatever your use case is.\n     * If Y is vertical in world coordinates, call Noise3_ImproveXZ(x, z, Y) or use Noise3_XZBeforeY.\n     * If Z is vertical in world coordinates, call Noise3_ImproveXZ(x, y, Z).\n     * For a time varied animation, call Noise3_ImproveXY(x, y, T).\n     */\n    public static float Noise3_ImproveXY(long seed, double x, double y, double z)\n    {\n        // Re-orient the cubic lattices without skewing, so Z points up the main lattice diagonal,\n        // and the planes formed by XY are moved far out of alignment with the cube faces.\n        // Orthonormal rotation. Not a skew transform.\n        double xy = x + y;\n        double s2 = xy * ROTATE3_ORTHOGONALIZER;\n        double zz = z * ROOT3OVER3;\n        double xr = x + s2 + zz;\n        double yr = y + s2 + zz;\n        double zr = xy * -ROOT3OVER3 + zz;\n\n        // Evaluate both lattices to form a BCC lattice.\n        return Noise3_UnrotatedBase(seed, xr, yr, zr);\n    }\n\n    /**\n     * 3D OpenSimplex2S/SuperSimplex noise, with better visual isotropy in (X, Z).\n     * Recommended for 3D terrain and time-varied animations.\n     * The Y coordinate should always be the \"different\" coordinate in whatever your use case is.\n     * If Y is vertical in world coordinates, call Noise3_ImproveXZ(x, Y, z).\n     * If Z is vertical in world coordinates, call Noise3_ImproveXZ(x, Z, y) or use Noise3_ImproveXY.\n     * For a time varied animation, call Noise3_ImproveXZ(x, T, y) or use Noise3_ImproveXY.\n     */\n    public static float Noise3_ImproveXZ(long seed, double x, double y, double z)\n    {\n        // Re-orient the cubic lattices without skewing, so Y points up the main lattice diagonal,\n        // and the planes formed by XZ are moved far out of alignment with the cube faces.\n        // Orthonormal rotation. Not a skew transform.\n        double xz = x + z;\n        double s2 = xz * -0.211324865405187;\n        double yy = y * ROOT3OVER3;\n        double xr = x + s2 + yy;\n        double zr = z + s2 + yy;\n        double yr = xz * -ROOT3OVER3 + yy;\n\n        // Evaluate both lattices to form a BCC lattice.\n        return Noise3_UnrotatedBase(seed, xr, yr, zr);\n    }\n\n    /**\n     * 3D OpenSimplex2S/SuperSimplex noise, fallback rotation option\n     * Use Noise3_ImproveXY or Noise3_ImproveXZ instead, wherever appropriate.\n     * They have less diagonal bias. This function's best use is as a fallback.\n     */\n    public static float Noise3_Fallback(long seed, double x, double y, double z)\n    {\n        // Re-orient the cubic lattices via rotation, to produce a familiar look.\n        // Orthonormal rotation. Not a skew transform.\n        double r = FALLBACK_ROTATE3 * (x + y + z);\n        double xr = r - x, yr = r - y, zr = r - z;\n\n        // Evaluate both lattices to form a BCC lattice.\n        return Noise3_UnrotatedBase(seed, xr, yr, zr);\n    }\n\n    /**\n     * Generate overlapping cubic lattices for 3D Re-oriented BCC noise.\n     * Lookup table implementation inspired by DigitalShadow.\n     * It was actually faster to narrow down the points in the loop itself,\n     * than to build up the index with enough info to isolate 8 points.\n     */\n    private static float Noise3_UnrotatedBase(long seed, double xr, double yr, double zr)\n    {\n        // Get base points and offsets.\n        int xrb = FastFloor(xr), yrb = FastFloor(yr), zrb = FastFloor(zr);\n        float xi = (float)(xr - xrb), yi = (float)(yr - yrb), zi = (float)(zr - zrb);\n\n        // Prime pre-multiplication for hash. Also flip seed for second lattice copy.\n        long xrbp = xrb * PRIME_X, yrbp = yrb * PRIME_Y, zrbp = zrb * PRIME_Z;\n        long seed2 = seed ^ -0x52D547B2E96ED629L;\n\n        // -1 if positive, 0 if negative.\n        int xNMask = (int)(-0.5f - xi), yNMask = (int)(-0.5f - yi), zNMask = (int)(-0.5f - zi);\n\n        // First vertex.\n        float x0 = xi + xNMask;\n        float y0 = yi + yNMask;\n        float z0 = zi + zNMask;\n        float a0 = RSQUARED_3D - x0 * x0 - y0 * y0 - z0 * z0;\n        float value = (a0 * a0) * (a0 * a0) * Grad(seed,\n            xrbp + (xNMask & PRIME_X), yrbp + (yNMask & PRIME_Y), zrbp + (zNMask & PRIME_Z), x0, y0, z0);\n\n        // Second vertex.\n        float x1 = xi - 0.5f;\n        float y1 = yi - 0.5f;\n        float z1 = zi - 0.5f;\n        float a1 = RSQUARED_3D - x1 * x1 - y1 * y1 - z1 * z1;\n        value += (a1 * a1) * (a1 * a1) * Grad(seed2,\n            xrbp + PRIME_X, yrbp + PRIME_Y, zrbp + PRIME_Z, x1, y1, z1);\n\n        // Shortcuts for building the remaining falloffs.\n        // Derived by subtracting the polynomials with the offsets plugged in.\n        float xAFlipMask0 = ((xNMask | 1) << 1) * x1;\n        float yAFlipMask0 = ((yNMask | 1) << 1) * y1;\n        float zAFlipMask0 = ((zNMask | 1) << 1) * z1;\n        float xAFlipMask1 = (-2 - (xNMask << 2)) * x1 - 1.0f;\n        float yAFlipMask1 = (-2 - (yNMask << 2)) * y1 - 1.0f;\n        float zAFlipMask1 = (-2 - (zNMask << 2)) * z1 - 1.0f;\n\n        bool skip5 = false;\n        float a2 = xAFlipMask0 + a0;\n        if (a2 > 0)\n        {\n            float x2 = x0 - (xNMask | 1);\n            float y2 = y0;\n            float z2 = z0;\n            value += (a2 * a2) * (a2 * a2) * Grad(seed,\n                xrbp + (~xNMask & PRIME_X), yrbp + (yNMask & PRIME_Y), zrbp + (zNMask & PRIME_Z), x2, y2, z2);\n        }\n        else\n        {\n            float a3 = yAFlipMask0 + zAFlipMask0 + a0;\n            if (a3 > 0)\n            {\n                float x3 = x0;\n                float y3 = y0 - (yNMask | 1);\n                float z3 = z0 - (zNMask | 1);\n                value += (a3 * a3) * (a3 * a3) * Grad(seed,\n                    xrbp + (xNMask & PRIME_X), yrbp + (~yNMask & PRIME_Y), zrbp + (~zNMask & PRIME_Z), x3, y3, z3);\n            }\n\n            float a4 = xAFlipMask1 + a1;\n            if (a4 > 0)\n            {\n                float x4 = (xNMask | 1) + x1;\n                float y4 = y1;\n                float z4 = z1;\n                value += (a4 * a4) * (a4 * a4) * Grad(seed2,\n                    xrbp + (xNMask & unchecked(PRIME_X * 2)), yrbp + PRIME_Y, zrbp + PRIME_Z, x4, y4, z4);\n                skip5 = true;\n            }\n        }\n\n        bool skip9 = false;\n        float a6 = yAFlipMask0 + a0;\n        if (a6 > 0)\n        {\n            float x6 = x0;\n            float y6 = y0 - (yNMask | 1);\n            float z6 = z0;\n            value += (a6 * a6) * (a6 * a6) * Grad(seed,\n                xrbp + (xNMask & PRIME_X), yrbp + (~yNMask & PRIME_Y), zrbp + (zNMask & PRIME_Z), x6, y6, z6);\n        }\n        else\n        {\n            float a7 = xAFlipMask0 + zAFlipMask0 + a0;\n            if (a7 > 0)\n            {\n                float x7 = x0 - (xNMask | 1);\n                float y7 = y0;\n                float z7 = z0 - (zNMask | 1);\n                value += (a7 * a7) * (a7 * a7) * Grad(seed,\n                    xrbp + (~xNMask & PRIME_X), yrbp + (yNMask & PRIME_Y), zrbp + (~zNMask & PRIME_Z), x7, y7, z7);\n            }\n\n            float a8 = yAFlipMask1 + a1;\n            if (a8 > 0)\n            {\n                float x8 = x1;\n                float y8 = (yNMask | 1) + y1;\n                float z8 = z1;\n                value += (a8 * a8) * (a8 * a8) * Grad(seed2,\n                    xrbp + PRIME_X, yrbp + (yNMask & (PRIME_Y << 1)), zrbp + PRIME_Z, x8, y8, z8);\n                skip9 = true;\n            }\n        }\n\n        bool skipD = false;\n        float aA = zAFlipMask0 + a0;\n        if (aA > 0)\n        {\n            float xA = x0;\n            float yA = y0;\n            float zA = z0 - (zNMask | 1);\n            value += (aA * aA) * (aA * aA) * Grad(seed,\n                xrbp + (xNMask & PRIME_X), yrbp + (yNMask & PRIME_Y), zrbp + (~zNMask & PRIME_Z), xA, yA, zA);\n        }\n        else\n        {\n            float aB = xAFlipMask0 + yAFlipMask0 + a0;\n            if (aB > 0)\n            {\n                float xB = x0 - (xNMask | 1);\n                float yB = y0 - (yNMask | 1);\n                float zB = z0;\n                value += (aB * aB) * (aB * aB) * Grad(seed,\n                    xrbp + (~xNMask & PRIME_X), yrbp + (~yNMask & PRIME_Y), zrbp + (zNMask & PRIME_Z), xB, yB, zB);\n            }\n\n            float aC = zAFlipMask1 + a1;\n            if (aC > 0)\n            {\n                float xC = x1;\n                float yC = y1;\n                float zC = (zNMask | 1) + z1;\n                value += (aC * aC) * (aC * aC) * Grad(seed2,\n                    xrbp + PRIME_X, yrbp + PRIME_Y, zrbp + (zNMask & (PRIME_Z << 1)), xC, yC, zC);\n                skipD = true;\n            }\n        }\n\n        if (!skip5)\n        {\n            float a5 = yAFlipMask1 + zAFlipMask1 + a1;\n            if (a5 > 0)\n            {\n                float x5 = x1;\n                float y5 = (yNMask | 1) + y1;\n                float z5 = (zNMask | 1) + z1;\n                value += (a5 * a5) * (a5 * a5) * Grad(seed2,\n                    xrbp + PRIME_X, yrbp + (yNMask & (PRIME_Y << 1)), zrbp + (zNMask & (PRIME_Z << 1)), x5, y5, z5);\n            }\n        }\n\n        if (!skip9)\n        {\n            float a9 = xAFlipMask1 + zAFlipMask1 + a1;\n            if (a9 > 0)\n            {\n                float x9 = (xNMask | 1) + x1;\n                float y9 = y1;\n                float z9 = (zNMask | 1) + z1;\n                value += (a9 * a9) * (a9 * a9) * Grad(seed2,\n                    xrbp + (xNMask & unchecked(PRIME_X * 2)), yrbp + PRIME_Y, zrbp + (zNMask & (PRIME_Z << 1)), x9, y9, z9);\n            }\n        }\n\n        if (!skipD)\n        {\n            float aD = xAFlipMask1 + yAFlipMask1 + a1;\n            if (aD > 0)\n            {\n                float xD = (xNMask | 1) + x1;\n                float yD = (yNMask | 1) + y1;\n                float zD = z1;\n                value += (aD * aD) * (aD * aD) * Grad(seed2,\n                    xrbp + (xNMask & (PRIME_X << 1)), yrbp + (yNMask & (PRIME_Y << 1)), zrbp + PRIME_Z, xD, yD, zD);\n            }\n        }\n\n        return value;\n    }\n\n    /**\n     * 4D SuperSimplex noise, with XYZ oriented like Noise3_ImproveXY\n     * and W for an extra degree of freedom. W repeats eventually.\n     * Recommended for time-varied animations which texture a 3D object (W=time)\n     * in a space where Z is vertical\n     */\n    public static float Noise4_ImproveXYZ_ImproveXY(long seed, double x, double y, double z, double w)\n    {\n        double xy = x + y;\n        double s2 = xy * -0.21132486540518699998;\n        double zz = z * 0.28867513459481294226;\n        double ww = w * 1.118033988749894;\n        double xr = x + (zz + ww + s2), yr = y + (zz + ww + s2);\n        double zr = xy * -0.57735026918962599998 + (zz + ww);\n        double wr = z * -0.866025403784439 + ww;\n\n        return Noise4_UnskewedBase(seed, xr, yr, zr, wr);\n    }\n\n    /**\n     * 4D SuperSimplex noise, with XYZ oriented like Noise3_ImproveXZ\n     * and W for an extra degree of freedom. W repeats eventually.\n     * Recommended for time-varied animations which texture a 3D object (W=time)\n     * in a space where Y is vertical\n     */\n    public static float Noise4_ImproveXYZ_ImproveXZ(long seed, double x, double y, double z, double w)\n    {\n        double xz = x + z;\n        double s2 = xz * -0.21132486540518699998;\n        double yy = y * 0.28867513459481294226;\n        double ww = w * 1.118033988749894;\n        double xr = x + (yy + ww + s2), zr = z + (yy + ww + s2);\n        double yr = xz * -0.57735026918962599998 + (yy + ww);\n        double wr = y * -0.866025403784439 + ww;\n\n        return Noise4_UnskewedBase(seed, xr, yr, zr, wr);\n    }\n\n    /**\n     * 4D SuperSimplex noise, with XYZ oriented like Noise3_Fallback\n     * and W for an extra degree of freedom. W repeats eventually.\n     * Recommended for time-varied animations which texture a 3D object (W=time)\n     * where there isn't a clear distinction between horizontal and vertical\n     */\n    public static float Noise4_ImproveXYZ(long seed, double x, double y, double z, double w)\n    {\n        double xyz = x + y + z;\n        double ww = w * 1.118033988749894;\n        double s2 = xyz * -0.16666666666666666 + ww;\n        double xs = x + s2, ys = y + s2, zs = z + s2, ws = -0.5 * xyz + ww;\n\n        return Noise4_UnskewedBase(seed, xs, ys, zs, ws);\n    }\n\n    /**\n     * 4D SuperSimplex noise, fallback lattice orientation.\n     */\n    public static float Noise4_Fallback(long seed, double x, double y, double z, double w)\n    {\n        // Get points for A4 lattice\n        double s = SKEW_4D * (x + y + z + w);\n        double xs = x + s, ys = y + s, zs = z + s, ws = w + s;\n\n        return Noise4_UnskewedBase(seed, xs, ys, zs, ws);\n    }\n\n    /**\n     * 4D SuperSimplex noise base.\n     * Using ultra-simple 4x4x4x4 lookup partitioning.\n     * This isn't as elegant or SIMD/GPU/etc. portable as other approaches,\n     * but it competes performance-wise with optimized 2014 OpenSimplex.\n     */\n    private static float Noise4_UnskewedBase(long seed, double xs, double ys, double zs, double ws)\n    {\n        // Get base points and offsets\n        int xsb = FastFloor(xs), ysb = FastFloor(ys), zsb = FastFloor(zs), wsb = FastFloor(ws);\n        float xsi = (float)(xs - xsb), ysi = (float)(ys - ysb), zsi = (float)(zs - zsb), wsi = (float)(ws - wsb);\n\n        // Unskewed offsets\n        float ssi = (xsi + ysi + zsi + wsi) * UNSKEW_4D;\n        float xi = xsi + ssi, yi = ysi + ssi, zi = zsi + ssi, wi = wsi + ssi;\n\n        // Prime pre-multiplication for hash.\n        long xsvp = xsb * PRIME_X, ysvp = ysb * PRIME_Y, zsvp = zsb * PRIME_Z, wsvp = wsb * PRIME_W;\n\n        // Index into initial table.\n        int index = ((FastFloor(xs * 4) & 3) << 0)\n            | ((FastFloor(ys * 4) & 3) << 2)\n            | ((FastFloor(zs * 4) & 3) << 4)\n            | ((FastFloor(ws * 4) & 3) << 6);\n\n        // Point contributions\n        float value = 0;\n        (int secondaryIndexStart, int secondaryIndexStop) = LOOKUP_4D_A[index];\n        for (int i = secondaryIndexStart; i < secondaryIndexStop; i++)\n        {\n            LatticeVertex4D c = LOOKUP_4D_B[i];\n            float dx = xi + c.dx, dy = yi + c.dy, dz = zi + c.dz, dw = wi + c.dw;\n            float a = (dx * dx + dy * dy) + (dz * dz + dw * dw);\n            if (a < RSQUARED_4D)\n            {\n                a -= RSQUARED_4D;\n                a *= a;\n                value += a * a * Grad(seed, xsvp + c.xsvp, ysvp + c.ysvp, zsvp + c.zsvp, wsvp + c.wsvp, dx, dy, dz, dw);\n            }\n        }\n        return value;\n    }\n\n    /*\n     * Utility\n     */\n\n    [MethodImpl(MethodImplOptions.AggressiveInlining)]\n    private static float Grad(long seed, long xsvp, long ysvp, float dx, float dy)\n    {\n        long hash = seed ^ xsvp ^ ysvp;\n        hash *= HASH_MULTIPLIER;\n        hash ^= hash >> (64 - N_GRADS_2D_EXPONENT + 1);\n        int gi = (int)hash & ((N_GRADS_2D - 1) << 1);\n        return GRADIENTS_2D[gi | 0] * dx + GRADIENTS_2D[gi | 1] * dy;\n    }\n\n    [MethodImpl(MethodImplOptions.AggressiveInlining)]\n    private static float Grad(long seed, long xrvp, long yrvp, long zrvp, float dx, float dy, float dz)\n    {\n        long hash = (seed ^ xrvp) ^ (yrvp ^ zrvp);\n        hash *= HASH_MULTIPLIER;\n        hash ^= hash >> (64 - N_GRADS_3D_EXPONENT + 2);\n        int gi = (int)hash & ((N_GRADS_3D - 1) << 2);\n        return GRADIENTS_3D[gi | 0] * dx + GRADIENTS_3D[gi | 1] * dy + GRADIENTS_3D[gi | 2] * dz;\n    }\n\n    [MethodImpl(MethodImplOptions.AggressiveInlining)]\n    private static float Grad(long seed, long xsvp, long ysvp, long zsvp, long wsvp, float dx, float dy, float dz, float dw)\n    {\n        long hash = seed ^ (xsvp ^ ysvp) ^ (zsvp ^ wsvp);\n        hash *= HASH_MULTIPLIER;\n        hash ^= hash >> (64 - N_GRADS_4D_EXPONENT + 2);\n        int gi = (int)hash & ((N_GRADS_4D - 1) << 2);\n        return (GRADIENTS_4D[gi | 0] * dx + GRADIENTS_4D[gi | 1] * dy) + (GRADIENTS_4D[gi | 2] * dz + GRADIENTS_4D[gi | 3] * dw);\n    }\n\n    [MethodImpl(MethodImplOptions.AggressiveInlining)]\n    private static int FastFloor(double x)\n    {\n        int xi = (int)x;\n        return x < xi ? xi - 1 : xi;\n    }\n\n    /*\n     * Lookup Tables & Gradients\n     */\n\n    private static readonly float[] GRADIENTS_2D;\n    private static readonly float[] GRADIENTS_3D;\n    private static readonly float[] GRADIENTS_4D;\n    private static readonly (short SecondaryIndexStart, short SecondaryIndexStop)[] LOOKUP_4D_A;\n    private static readonly LatticeVertex4D[] LOOKUP_4D_B;\n\n    static OpenSimplex2S()\n    {\n\n        GRADIENTS_2D = new float[N_GRADS_2D * 2];\n        float[] grad2 = {\n                 0.38268343236509f,   0.923879532511287f,\n                 0.923879532511287f,  0.38268343236509f,\n                 0.923879532511287f, -0.38268343236509f,\n                 0.38268343236509f,  -0.923879532511287f,\n                -0.38268343236509f,  -0.923879532511287f,\n                -0.923879532511287f, -0.38268343236509f,\n                -0.923879532511287f,  0.38268343236509f,\n                -0.38268343236509f,   0.923879532511287f,\n                //-------------------------------------//\n                 0.130526192220052f,  0.99144486137381f,\n                 0.608761429008721f,  0.793353340291235f,\n                 0.793353340291235f,  0.608761429008721f,\n                 0.99144486137381f,   0.130526192220051f,\n                 0.99144486137381f,  -0.130526192220051f,\n                 0.793353340291235f, -0.60876142900872f,\n                 0.608761429008721f, -0.793353340291235f,\n                 0.130526192220052f, -0.99144486137381f,\n                -0.130526192220052f, -0.99144486137381f,\n                -0.608761429008721f, -0.793353340291235f,\n                -0.793353340291235f, -0.608761429008721f,\n                -0.99144486137381f,  -0.130526192220052f,\n                -0.99144486137381f,   0.130526192220051f,\n                -0.793353340291235f,  0.608761429008721f,\n                -0.608761429008721f,  0.793353340291235f,\n                -0.130526192220052f,  0.99144486137381f,\n        };\n        for (int i = 0; i < grad2.Length; i++)\n        {\n            grad2[i] = (float)(grad2[i] / NORMALIZER_2D);\n        }\n        for (int i = 0, j = 0; i < GRADIENTS_2D.Length; i++, j++)\n        {\n            if (j == grad2.Length) j = 0;\n            GRADIENTS_2D[i] = grad2[j];\n        }\n\n        GRADIENTS_3D = new float[N_GRADS_3D * 4];\n        float[] grad3 = {\n             2.22474487139f,       2.22474487139f,      -1.0f,                 0.0f,\n             2.22474487139f,       2.22474487139f,       1.0f,                 0.0f,\n             3.0862664687972017f,  1.1721513422464978f,  0.0f,                 0.0f,\n             1.1721513422464978f,  3.0862664687972017f,  0.0f,                 0.0f,\n            -2.22474487139f,       2.22474487139f,      -1.0f,                 0.0f,\n            -2.22474487139f,       2.22474487139f,       1.0f,                 0.0f,\n            -1.1721513422464978f,  3.0862664687972017f,  0.0f,                 0.0f,\n            -3.0862664687972017f,  1.1721513422464978f,  0.0f,                 0.0f,\n            -1.0f,                -2.22474487139f,      -2.22474487139f,       0.0f,\n             1.0f,                -2.22474487139f,      -2.22474487139f,       0.0f,\n             0.0f,                -3.0862664687972017f, -1.1721513422464978f,  0.0f,\n             0.0f,                -1.1721513422464978f, -3.0862664687972017f,  0.0f,\n            -1.0f,                -2.22474487139f,       2.22474487139f,       0.0f,\n             1.0f,                -2.22474487139f,       2.22474487139f,       0.0f,\n             0.0f,                -1.1721513422464978f,  3.0862664687972017f,  0.0f,\n             0.0f,                -3.0862664687972017f,  1.1721513422464978f,  0.0f,\n            //--------------------------------------------------------------------//\n            -2.22474487139f,      -2.22474487139f,      -1.0f,                 0.0f,\n            -2.22474487139f,      -2.22474487139f,       1.0f,                 0.0f,\n            -3.0862664687972017f, -1.1721513422464978f,  0.0f,                 0.0f,\n            -1.1721513422464978f, -3.0862664687972017f,  0.0f,                 0.0f,\n            -2.22474487139f,      -1.0f,                -2.22474487139f,       0.0f,\n            -2.22474487139f,       1.0f,                -2.22474487139f,       0.0f,\n            -1.1721513422464978f,  0.0f,                -3.0862664687972017f,  0.0f,\n            -3.0862664687972017f,  0.0f,                -1.1721513422464978f,  0.0f,\n            -2.22474487139f,      -1.0f,                 2.22474487139f,       0.0f,\n            -2.22474487139f,       1.0f,                 2.22474487139f,       0.0f,\n            -3.0862664687972017f,  0.0f,                 1.1721513422464978f,  0.0f,\n            -1.1721513422464978f,  0.0f,                 3.0862664687972017f,  0.0f,\n            -1.0f,                 2.22474487139f,      -2.22474487139f,       0.0f,\n             1.0f,                 2.22474487139f,      -2.22474487139f,       0.0f,\n             0.0f,                 1.1721513422464978f, -3.0862664687972017f,  0.0f,\n             0.0f,                 3.0862664687972017f, -1.1721513422464978f,  0.0f,\n            -1.0f,                 2.22474487139f,       2.22474487139f,       0.0f,\n             1.0f,                 2.22474487139f,       2.22474487139f,       0.0f,\n             0.0f,                 3.0862664687972017f,  1.1721513422464978f,  0.0f,\n             0.0f,                 1.1721513422464978f,  3.0862664687972017f,  0.0f,\n             2.22474487139f,      -2.22474487139f,      -1.0f,                 0.0f,\n             2.22474487139f,      -2.22474487139f,       1.0f,                 0.0f,\n             1.1721513422464978f, -3.0862664687972017f,  0.0f,                 0.0f,\n             3.0862664687972017f, -1.1721513422464978f,  0.0f,                 0.0f,\n             2.22474487139f,      -1.0f,                -2.22474487139f,       0.0f,\n             2.22474487139f,       1.0f,                -2.22474487139f,       0.0f,\n             3.0862664687972017f,  0.0f,                -1.1721513422464978f,  0.0f,\n             1.1721513422464978f,  0.0f,                -3.0862664687972017f,  0.0f,\n             2.22474487139f,      -1.0f,                 2.22474487139f,       0.0f,\n             2.22474487139f,       1.0f,                 2.22474487139f,       0.0f,\n             1.1721513422464978f,  0.0f,                 3.0862664687972017f,  0.0f,\n             3.0862664687972017f,  0.0f,                 1.1721513422464978f,  0.0f,\n        };\n        for (int i = 0; i < grad3.Length; i++)\n        {\n            grad3[i] = (float)(grad3[i] / NORMALIZER_3D);\n        }\n        for (int i = 0, j = 0; i < GRADIENTS_3D.Length; i++, j++)\n        {\n            if (j == grad3.Length) j = 0;\n            GRADIENTS_3D[i] = grad3[j];\n        }\n\n        GRADIENTS_4D = new float[N_GRADS_4D * 4];\n        float[] grad4 = {\n            -0.6740059517812944f,   -0.3239847771997537f,   -0.3239847771997537f,    0.5794684678643381f,\n            -0.7504883828755602f,   -0.4004672082940195f,    0.15296486218853164f,   0.5029860367700724f,\n            -0.7504883828755602f,    0.15296486218853164f,  -0.4004672082940195f,    0.5029860367700724f,\n            -0.8828161875373585f,    0.08164729285680945f,   0.08164729285680945f,   0.4553054119602712f,\n            -0.4553054119602712f,   -0.08164729285680945f,  -0.08164729285680945f,   0.8828161875373585f,\n            -0.5029860367700724f,   -0.15296486218853164f,   0.4004672082940195f,    0.7504883828755602f,\n            -0.5029860367700724f,    0.4004672082940195f,   -0.15296486218853164f,   0.7504883828755602f,\n            -0.5794684678643381f,    0.3239847771997537f,    0.3239847771997537f,    0.6740059517812944f,\n            -0.6740059517812944f,   -0.3239847771997537f,    0.5794684678643381f,   -0.3239847771997537f,\n            -0.7504883828755602f,   -0.4004672082940195f,    0.5029860367700724f,    0.15296486218853164f,\n            -0.7504883828755602f,    0.15296486218853164f,   0.5029860367700724f,   -0.4004672082940195f,\n            -0.8828161875373585f,    0.08164729285680945f,   0.4553054119602712f,    0.08164729285680945f,\n            -0.4553054119602712f,   -0.08164729285680945f,   0.8828161875373585f,   -0.08164729285680945f,\n            -0.5029860367700724f,   -0.15296486218853164f,   0.7504883828755602f,    0.4004672082940195f,\n            -0.5029860367700724f,    0.4004672082940195f,    0.7504883828755602f,   -0.15296486218853164f,\n            -0.5794684678643381f,    0.3239847771997537f,    0.6740059517812944f,    0.3239847771997537f,\n            -0.6740059517812944f,    0.5794684678643381f,   -0.3239847771997537f,   -0.3239847771997537f,\n            -0.7504883828755602f,    0.5029860367700724f,   -0.4004672082940195f,    0.15296486218853164f,\n            -0.7504883828755602f,    0.5029860367700724f,    0.15296486218853164f,  -0.4004672082940195f,\n            -0.8828161875373585f,    0.4553054119602712f,    0.08164729285680945f,   0.08164729285680945f,\n            -0.4553054119602712f,    0.8828161875373585f,   -0.08164729285680945f,  -0.08164729285680945f,\n            -0.5029860367700724f,    0.7504883828755602f,   -0.15296486218853164f,   0.4004672082940195f,\n            -0.5029860367700724f,    0.7504883828755602f,    0.4004672082940195f,   -0.15296486218853164f,\n            -0.5794684678643381f,    0.6740059517812944f,    0.3239847771997537f,    0.3239847771997537f,\n             0.5794684678643381f,   -0.6740059517812944f,   -0.3239847771997537f,   -0.3239847771997537f,\n             0.5029860367700724f,   -0.7504883828755602f,   -0.4004672082940195f,    0.15296486218853164f,\n             0.5029860367700724f,   -0.7504883828755602f,    0.15296486218853164f,  -0.4004672082940195f,\n             0.4553054119602712f,   -0.8828161875373585f,    0.08164729285680945f,   0.08164729285680945f,\n             0.8828161875373585f,   -0.4553054119602712f,   -0.08164729285680945f,  -0.08164729285680945f,\n             0.7504883828755602f,   -0.5029860367700724f,   -0.15296486218853164f,   0.4004672082940195f,\n             0.7504883828755602f,   -0.5029860367700724f,    0.4004672082940195f,   -0.15296486218853164f,\n             0.6740059517812944f,   -0.5794684678643381f,    0.3239847771997537f,    0.3239847771997537f,\n            //------------------------------------------------------------------------------------------//\n            -0.753341017856078f,    -0.37968289875261624f,  -0.37968289875261624f,  -0.37968289875261624f,\n            -0.7821684431180708f,   -0.4321472685365301f,   -0.4321472685365301f,    0.12128480194602098f,\n            -0.7821684431180708f,   -0.4321472685365301f,    0.12128480194602098f,  -0.4321472685365301f,\n            -0.7821684431180708f,    0.12128480194602098f,  -0.4321472685365301f,   -0.4321472685365301f,\n            -0.8586508742123365f,   -0.508629699630796f,     0.044802370851755174f,  0.044802370851755174f,\n            -0.8586508742123365f,    0.044802370851755174f, -0.508629699630796f,     0.044802370851755174f,\n            -0.8586508742123365f,    0.044802370851755174f,  0.044802370851755174f, -0.508629699630796f,\n            -0.9982828964265062f,   -0.03381941603233842f,  -0.03381941603233842f,  -0.03381941603233842f,\n            -0.37968289875261624f,  -0.753341017856078f,    -0.37968289875261624f,  -0.37968289875261624f,\n            -0.4321472685365301f,   -0.7821684431180708f,   -0.4321472685365301f,    0.12128480194602098f,\n            -0.4321472685365301f,   -0.7821684431180708f,    0.12128480194602098f,  -0.4321472685365301f,\n             0.12128480194602098f,  -0.7821684431180708f,   -0.4321472685365301f,   -0.4321472685365301f,\n            -0.508629699630796f,    -0.8586508742123365f,    0.044802370851755174f,  0.044802370851755174f,\n             0.044802370851755174f, -0.8586508742123365f,   -0.508629699630796f,     0.044802370851755174f,\n             0.044802370851755174f, -0.8586508742123365f,    0.044802370851755174f, -0.508629699630796f,\n            -0.03381941603233842f,  -0.9982828964265062f,   -0.03381941603233842f,  -0.03381941603233842f,\n            -0.37968289875261624f,  -0.37968289875261624f,  -0.753341017856078f,    -0.37968289875261624f,\n            -0.4321472685365301f,   -0.4321472685365301f,   -0.7821684431180708f,    0.12128480194602098f,\n            -0.4321472685365301f,    0.12128480194602098f,  -0.7821684431180708f,   -0.4321472685365301f,\n             0.12128480194602098f,  -0.4321472685365301f,   -0.7821684431180708f,   -0.4321472685365301f,\n            -0.508629699630796f,     0.044802370851755174f, -0.8586508742123365f,    0.044802370851755174f,\n             0.044802370851755174f, -0.508629699630796f,    -0.8586508742123365f,    0.044802370851755174f,\n             0.044802370851755174f,  0.044802370851755174f, -0.8586508742123365f,   -0.508629699630796f,\n            -0.03381941603233842f,  -0.03381941603233842f,  -0.9982828964265062f,   -0.03381941603233842f,\n            -0.37968289875261624f,  -0.37968289875261624f,  -0.37968289875261624f,  -0.753341017856078f,\n            -0.4321472685365301f,   -0.4321472685365301f,    0.12128480194602098f,  -0.7821684431180708f,\n            -0.4321472685365301f,    0.12128480194602098f,  -0.4321472685365301f,   -0.7821684431180708f,\n             0.12128480194602098f,  -0.4321472685365301f,   -0.4321472685365301f,   -0.7821684431180708f,\n            -0.508629699630796f,     0.044802370851755174f,  0.044802370851755174f, -0.8586508742123365f,\n             0.044802370851755174f, -0.508629699630796f,     0.044802370851755174f, -0.8586508742123365f,\n             0.044802370851755174f,  0.044802370851755174f, -0.508629699630796f,    -0.8586508742123365f,\n            -0.03381941603233842f,  -0.03381941603233842f,  -0.03381941603233842f,  -0.9982828964265062f,\n            -0.3239847771997537f,   -0.6740059517812944f,   -0.3239847771997537f,    0.5794684678643381f,\n            -0.4004672082940195f,   -0.7504883828755602f,    0.15296486218853164f,   0.5029860367700724f,\n             0.15296486218853164f,  -0.7504883828755602f,   -0.4004672082940195f,    0.5029860367700724f,\n             0.08164729285680945f,  -0.8828161875373585f,    0.08164729285680945f,   0.4553054119602712f,\n            -0.08164729285680945f,  -0.4553054119602712f,   -0.08164729285680945f,   0.8828161875373585f,\n            -0.15296486218853164f,  -0.5029860367700724f,    0.4004672082940195f,    0.7504883828755602f,\n             0.4004672082940195f,   -0.5029860367700724f,   -0.15296486218853164f,   0.7504883828755602f,\n             0.3239847771997537f,   -0.5794684678643381f,    0.3239847771997537f,    0.6740059517812944f,\n            -0.3239847771997537f,   -0.3239847771997537f,   -0.6740059517812944f,    0.5794684678643381f,\n            -0.4004672082940195f,    0.15296486218853164f,  -0.7504883828755602f,    0.5029860367700724f,\n             0.15296486218853164f,  -0.4004672082940195f,   -0.7504883828755602f,    0.5029860367700724f,\n             0.08164729285680945f,   0.08164729285680945f,  -0.8828161875373585f,    0.4553054119602712f,\n            -0.08164729285680945f,  -0.08164729285680945f,  -0.4553054119602712f,    0.8828161875373585f,\n            -0.15296486218853164f,   0.4004672082940195f,   -0.5029860367700724f,    0.7504883828755602f,\n             0.4004672082940195f,   -0.15296486218853164f,  -0.5029860367700724f,    0.7504883828755602f,\n             0.3239847771997537f,    0.3239847771997537f,   -0.5794684678643381f,    0.6740059517812944f,\n            -0.3239847771997537f,   -0.6740059517812944f,    0.5794684678643381f,   -0.3239847771997537f,\n            -0.4004672082940195f,   -0.7504883828755602f,    0.5029860367700724f,    0.15296486218853164f,\n             0.15296486218853164f,  -0.7504883828755602f,    0.5029860367700724f,   -0.4004672082940195f,\n             0.08164729285680945f,  -0.8828161875373585f,    0.4553054119602712f,    0.08164729285680945f,\n            -0.08164729285680945f,  -0.4553054119602712f,    0.8828161875373585f,   -0.08164729285680945f,\n            -0.15296486218853164f,  -0.5029860367700724f,    0.7504883828755602f,    0.4004672082940195f,\n             0.4004672082940195f,   -0.5029860367700724f,    0.7504883828755602f,   -0.15296486218853164f,\n             0.3239847771997537f,   -0.5794684678643381f,    0.6740059517812944f,    0.3239847771997537f,\n            -0.3239847771997537f,   -0.3239847771997537f,    0.5794684678643381f,   -0.6740059517812944f,\n            -0.4004672082940195f,    0.15296486218853164f,   0.5029860367700724f,   -0.7504883828755602f,\n             0.15296486218853164f,  -0.4004672082940195f,    0.5029860367700724f,   -0.7504883828755602f,\n             0.08164729285680945f,   0.08164729285680945f,   0.4553054119602712f,   -0.8828161875373585f,\n            -0.08164729285680945f,  -0.08164729285680945f,   0.8828161875373585f,   -0.4553054119602712f,\n            -0.15296486218853164f,   0.4004672082940195f,    0.7504883828755602f,   -0.5029860367700724f,\n             0.4004672082940195f,   -0.15296486218853164f,   0.7504883828755602f,   -0.5029860367700724f,\n             0.3239847771997537f,    0.3239847771997537f,    0.6740059517812944f,   -0.5794684678643381f,\n            -0.3239847771997537f,    0.5794684678643381f,   -0.6740059517812944f,   -0.3239847771997537f,\n            -0.4004672082940195f,    0.5029860367700724f,   -0.7504883828755602f,    0.15296486218853164f,\n             0.15296486218853164f,   0.5029860367700724f,   -0.7504883828755602f,   -0.4004672082940195f,\n             0.08164729285680945f,   0.4553054119602712f,   -0.8828161875373585f,    0.08164729285680945f,\n            -0.08164729285680945f,   0.8828161875373585f,   -0.4553054119602712f,   -0.08164729285680945f,\n            -0.15296486218853164f,   0.7504883828755602f,   -0.5029860367700724f,    0.4004672082940195f,\n             0.4004672082940195f,    0.7504883828755602f,   -0.5029860367700724f,   -0.15296486218853164f,\n             0.3239847771997537f,    0.6740059517812944f,   -0.5794684678643381f,    0.3239847771997537f,\n            -0.3239847771997537f,    0.5794684678643381f,   -0.3239847771997537f,   -0.6740059517812944f,\n            -0.4004672082940195f,    0.5029860367700724f,    0.15296486218853164f,  -0.7504883828755602f,\n             0.15296486218853164f,   0.5029860367700724f,   -0.4004672082940195f,   -0.7504883828755602f,\n             0.08164729285680945f,   0.4553054119602712f,    0.08164729285680945f,  -0.8828161875373585f,\n            -0.08164729285680945f,   0.8828161875373585f,   -0.08164729285680945f,  -0.4553054119602712f,\n            -0.15296486218853164f,   0.7504883828755602f,    0.4004672082940195f,   -0.5029860367700724f,\n             0.4004672082940195f,    0.7504883828755602f,   -0.15296486218853164f,  -0.5029860367700724f,\n             0.3239847771997537f,    0.6740059517812944f,    0.3239847771997537f,   -0.5794684678643381f,\n             0.5794684678643381f,   -0.3239847771997537f,   -0.6740059517812944f,   -0.3239847771997537f,\n             0.5029860367700724f,   -0.4004672082940195f,   -0.7504883828755602f,    0.15296486218853164f,\n             0.5029860367700724f,    0.15296486218853164f,  -0.7504883828755602f,   -0.4004672082940195f,\n             0.4553054119602712f,    0.08164729285680945f,  -0.8828161875373585f,    0.08164729285680945f,\n             0.8828161875373585f,   -0.08164729285680945f,  -0.4553054119602712f,   -0.08164729285680945f,\n             0.7504883828755602f,   -0.15296486218853164f,  -0.5029860367700724f,    0.4004672082940195f,\n             0.7504883828755602f,    0.4004672082940195f,   -0.5029860367700724f,   -0.15296486218853164f,\n             0.6740059517812944f,    0.3239847771997537f,   -0.5794684678643381f,    0.3239847771997537f,\n             0.5794684678643381f,   -0.3239847771997537f,   -0.3239847771997537f,   -0.6740059517812944f,\n             0.5029860367700724f,   -0.4004672082940195f,    0.15296486218853164f,  -0.7504883828755602f,\n             0.5029860367700724f,    0.15296486218853164f,  -0.4004672082940195f,   -0.7504883828755602f,\n             0.4553054119602712f,    0.08164729285680945f,   0.08164729285680945f,  -0.8828161875373585f,\n             0.8828161875373585f,   -0.08164729285680945f,  -0.08164729285680945f,  -0.4553054119602712f,\n             0.7504883828755602f,   -0.15296486218853164f,   0.4004672082940195f,   -0.5029860367700724f,\n             0.7504883828755602f,    0.4004672082940195f,   -0.15296486218853164f,  -0.5029860367700724f,\n             0.6740059517812944f,    0.3239847771997537f,    0.3239847771997537f,   -0.5794684678643381f,\n             0.03381941603233842f,   0.03381941603233842f,   0.03381941603233842f,   0.9982828964265062f,\n            -0.044802370851755174f, -0.044802370851755174f,  0.508629699630796f,     0.8586508742123365f,\n            -0.044802370851755174f,  0.508629699630796f,    -0.044802370851755174f,  0.8586508742123365f,\n            -0.12128480194602098f,   0.4321472685365301f,    0.4321472685365301f,    0.7821684431180708f,\n             0.508629699630796f,    -0.044802370851755174f, -0.044802370851755174f,  0.8586508742123365f,\n             0.4321472685365301f,   -0.12128480194602098f,   0.4321472685365301f,    0.7821684431180708f,\n             0.4321472685365301f,    0.4321472685365301f,   -0.12128480194602098f,   0.7821684431180708f,\n             0.37968289875261624f,   0.37968289875261624f,   0.37968289875261624f,   0.753341017856078f,\n             0.03381941603233842f,   0.03381941603233842f,   0.9982828964265062f,    0.03381941603233842f,\n            -0.044802370851755174f,  0.044802370851755174f,  0.8586508742123365f,    0.508629699630796f,\n            -0.044802370851755174f,  0.508629699630796f,     0.8586508742123365f,   -0.044802370851755174f,\n            -0.12128480194602098f,   0.4321472685365301f,    0.7821684431180708f,    0.4321472685365301f,\n             0.508629699630796f,    -0.044802370851755174f,  0.8586508742123365f,   -0.044802370851755174f,\n             0.4321472685365301f,   -0.12128480194602098f,   0.7821684431180708f,    0.4321472685365301f,\n             0.4321472685365301f,    0.4321472685365301f,    0.7821684431180708f,   -0.12128480194602098f,\n             0.37968289875261624f,   0.37968289875261624f,   0.753341017856078f,     0.37968289875261624f,\n             0.03381941603233842f,   0.9982828964265062f,    0.03381941603233842f,   0.03381941603233842f,\n            -0.044802370851755174f,  0.8586508742123365f,   -0.044802370851755174f,  0.508629699630796f,\n            -0.044802370851755174f,  0.8586508742123365f,    0.508629699630796f,    -0.044802370851755174f,\n            -0.12128480194602098f,   0.7821684431180708f,    0.4321472685365301f,    0.4321472685365301f,\n             0.508629699630796f,     0.8586508742123365f,   -0.044802370851755174f, -0.044802370851755174f,\n             0.4321472685365301f,    0.7821684431180708f,   -0.12128480194602098f,   0.4321472685365301f,\n             0.4321472685365301f,    0.7821684431180708f,    0.4321472685365301f,   -0.12128480194602098f,\n             0.37968289875261624f,   0.753341017856078f,     0.37968289875261624f,   0.37968289875261624f,\n             0.9982828964265062f,    0.03381941603233842f,   0.03381941603233842f,   0.03381941603233842f,\n             0.8586508742123365f,   -0.044802370851755174f, -0.044802370851755174f,  0.508629699630796f,\n             0.8586508742123365f,   -0.044802370851755174f,  0.508629699630796f,    -0.044802370851755174f,\n             0.7821684431180708f,   -0.12128480194602098f,   0.4321472685365301f,    0.4321472685365301f,\n             0.8586508742123365f,    0.508629699630796f,    -0.044802370851755174f, -0.044802370851755174f,\n             0.7821684431180708f,    0.4321472685365301f,   -0.12128480194602098f,   0.4321472685365301f,\n             0.7821684431180708f,    0.4321472685365301f,    0.4321472685365301f,   -0.12128480194602098f,\n             0.753341017856078f,     0.37968289875261624f,   0.37968289875261624f,   0.37968289875261624f,\n        };\n        for (int i = 0; i < grad4.Length; i++)\n        {\n            grad4[i] = (float)(grad4[i] / NORMALIZER_4D);\n        }\n        for (int i = 0, j = 0; i < GRADIENTS_4D.Length; i++, j++)\n        {\n            if (j == grad4.Length) j = 0;\n            GRADIENTS_4D[i] = grad4[j];\n        }\n\n        int[][] lookup4DVertexCodes = {\n            new int[] { 0x15, 0x45, 0x51, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x15, 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xAA },\n            new int[] { 0x01, 0x05, 0x11, 0x15, 0x41, 0x45, 0x51, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA },\n            new int[] { 0x01, 0x15, 0x16, 0x45, 0x46, 0x51, 0x52, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n            new int[] { 0x15, 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA9, 0xAA },\n            new int[] { 0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xAA },\n            new int[] { 0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xAA },\n            new int[] { 0x05, 0x15, 0x16, 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xAA, 0xAB },\n            new int[] { 0x04, 0x05, 0x14, 0x15, 0x44, 0x45, 0x54, 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA },\n            new int[] { 0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xAA },\n            new int[] { 0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x9A, 0xAA },\n            new int[] { 0x05, 0x15, 0x16, 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x5B, 0x6A, 0x9A, 0xAA, 0xAB },\n            new int[] { 0x04, 0x15, 0x19, 0x45, 0x49, 0x54, 0x55, 0x58, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x05, 0x15, 0x19, 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xAA, 0xAE },\n            new int[] { 0x05, 0x15, 0x19, 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x5E, 0x6A, 0x9A, 0xAA, 0xAE },\n            new int[] { 0x05, 0x15, 0x1A, 0x45, 0x4A, 0x55, 0x56, 0x59, 0x5A, 0x5B, 0x5E, 0x6A, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n            new int[] { 0x15, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0xA5, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x11, 0x15, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xAA },\n            new int[] { 0x11, 0x15, 0x51, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x96, 0xA6, 0xAA },\n            new int[] { 0x11, 0x15, 0x16, 0x51, 0x52, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x96, 0xA6, 0xAA, 0xAB },\n            new int[] { 0x14, 0x15, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA9, 0xAA },\n            new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x9A, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n            new int[] { 0x15, 0x16, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x6B, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n            new int[] { 0x14, 0x15, 0x54, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x99, 0xA9, 0xAA },\n            new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x9A, 0xAA },\n            new int[] { 0x15, 0x16, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x6B, 0x9A, 0xAA, 0xAB },\n            new int[] { 0x14, 0x15, 0x19, 0x54, 0x55, 0x58, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x99, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x15, 0x19, 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x6E, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x15, 0x19, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x6E, 0x9A, 0xAA, 0xAE },\n            new int[] { 0x15, 0x1A, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x6B, 0x6E, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n            new int[] { 0x10, 0x11, 0x14, 0x15, 0x50, 0x51, 0x54, 0x55, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x11, 0x15, 0x51, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xAA },\n            new int[] { 0x11, 0x15, 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0xA6, 0xAA },\n            new int[] { 0x11, 0x15, 0x16, 0x51, 0x52, 0x55, 0x56, 0x65, 0x66, 0x67, 0x6A, 0xA6, 0xAA, 0xAB },\n            new int[] { 0x14, 0x15, 0x54, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA9, 0xAA },\n            new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n            new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA6, 0xAA },\n            new int[] { 0x15, 0x16, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x6B, 0xA6, 0xAA, 0xAB },\n            new int[] { 0x14, 0x15, 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0xA9, 0xAA },\n            new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA9, 0xAA },\n            new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xAA },\n            new int[] { 0x15, 0x16, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6B, 0xAA, 0xAB },\n            new int[] { 0x14, 0x15, 0x19, 0x54, 0x55, 0x58, 0x59, 0x65, 0x69, 0x6A, 0x6D, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x15, 0x19, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x6E, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x15, 0x19, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6E, 0xAA, 0xAE },\n            new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x69, 0x6A, 0x6B, 0x6E, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n            new int[] { 0x10, 0x15, 0x25, 0x51, 0x54, 0x55, 0x61, 0x64, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n            new int[] { 0x11, 0x15, 0x25, 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xAA, 0xBA },\n            new int[] { 0x11, 0x15, 0x25, 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x6A, 0x76, 0xA6, 0xAA, 0xBA },\n            new int[] { 0x11, 0x15, 0x26, 0x51, 0x55, 0x56, 0x62, 0x65, 0x66, 0x67, 0x6A, 0x76, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n            new int[] { 0x14, 0x15, 0x25, 0x54, 0x55, 0x59, 0x64, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA9, 0xAA, 0xBA },\n            new int[] { 0x15, 0x25, 0x55, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n            new int[] { 0x15, 0x25, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xA6, 0xAA, 0xBA },\n            new int[] { 0x15, 0x26, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x6B, 0x7A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n            new int[] { 0x14, 0x15, 0x25, 0x54, 0x55, 0x59, 0x64, 0x65, 0x69, 0x6A, 0x79, 0xA9, 0xAA, 0xBA },\n            new int[] { 0x15, 0x25, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xA9, 0xAA, 0xBA },\n            new int[] { 0x15, 0x25, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xAA, 0xBA },\n            new int[] { 0x15, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6B, 0x7A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n            new int[] { 0x14, 0x15, 0x29, 0x54, 0x55, 0x59, 0x65, 0x68, 0x69, 0x6A, 0x6D, 0x79, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n            new int[] { 0x15, 0x29, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x6E, 0x7A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n            new int[] { 0x15, 0x55, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6E, 0x7A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n            new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6B, 0x6E, 0x7A, 0xAA, 0xAB, 0xAE, 0xBA, 0xBF },\n            new int[] { 0x45, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xAA },\n            new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x5A, 0x66, 0x95, 0x96, 0x9A, 0xA6, 0xAA },\n            new int[] { 0x41, 0x45, 0x46, 0x51, 0x52, 0x55, 0x56, 0x5A, 0x66, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n            new int[] { 0x44, 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA9, 0xAA },\n            new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xAB },\n            new int[] { 0x45, 0x46, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB },\n            new int[] { 0x44, 0x45, 0x54, 0x55, 0x59, 0x5A, 0x69, 0x95, 0x99, 0x9A, 0xA9, 0xAA },\n            new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xAA },\n            new int[] { 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x96, 0x9A, 0x9B, 0xAA, 0xAB },\n            new int[] { 0x44, 0x45, 0x49, 0x54, 0x55, 0x58, 0x59, 0x5A, 0x69, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x45, 0x49, 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x99, 0x9A, 0x9E, 0xAA, 0xAE },\n            new int[] { 0x45, 0x4A, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x9A, 0x9B, 0x9E, 0xAA, 0xAB, 0xAE, 0xAF },\n            new int[] { 0x50, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x95, 0x96, 0x99, 0xA5, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x51, 0x55, 0x56, 0x59, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x51, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xAB },\n            new int[] { 0x51, 0x52, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xA7, 0xAA, 0xAB },\n            new int[] { 0x54, 0x55, 0x56, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x15, 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n            new int[] { 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n            new int[] { 0x54, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x15, 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE },\n            new int[] { 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n            new int[] { 0x54, 0x55, 0x58, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAD, 0xAE },\n            new int[] { 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n            new int[] { 0x50, 0x51, 0x54, 0x55, 0x65, 0x66, 0x69, 0x95, 0xA5, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n            new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xAA },\n            new int[] { 0x51, 0x52, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x96, 0xA6, 0xA7, 0xAA, 0xAB },\n            new int[] { 0x54, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n            new int[] { 0x15, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n            new int[] { 0x15, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xBA },\n            new int[] { 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n            new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA9, 0xAA },\n            new int[] { 0x15, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xBA },\n            new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x9A, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n            new int[] { 0x54, 0x55, 0x58, 0x59, 0x65, 0x69, 0x6A, 0x99, 0xA9, 0xAA, 0xAD, 0xAE },\n            new int[] { 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x69, 0x6A, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n            new int[] { 0x50, 0x51, 0x54, 0x55, 0x61, 0x64, 0x65, 0x66, 0x69, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n            new int[] { 0x51, 0x55, 0x61, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA },\n            new int[] { 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x6A, 0xA5, 0xA6, 0xAA, 0xB6, 0xBA },\n            new int[] { 0x51, 0x55, 0x56, 0x62, 0x65, 0x66, 0x6A, 0xA6, 0xA7, 0xAA, 0xAB, 0xB6, 0xBA, 0xBB },\n            new int[] { 0x54, 0x55, 0x64, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA },\n            new int[] { 0x55, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n            new int[] { 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n            new int[] { 0x55, 0x56, 0x65, 0x66, 0x6A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n            new int[] { 0x54, 0x55, 0x59, 0x64, 0x65, 0x69, 0x6A, 0xA5, 0xA9, 0xAA, 0xB9, 0xBA },\n            new int[] { 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n            new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n            new int[] { 0x15, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n            new int[] { 0x54, 0x55, 0x59, 0x65, 0x68, 0x69, 0x6A, 0xA9, 0xAA, 0xAD, 0xAE, 0xB9, 0xBA, 0xBE },\n            new int[] { 0x55, 0x59, 0x65, 0x69, 0x6A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n            new int[] { 0x15, 0x55, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n            new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xAA, 0xAB, 0xAE, 0xBA, 0xBF },\n            new int[] { 0x40, 0x41, 0x44, 0x45, 0x50, 0x51, 0x54, 0x55, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xAA },\n            new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x95, 0x96, 0x9A, 0xA6, 0xAA },\n            new int[] { 0x41, 0x45, 0x46, 0x51, 0x52, 0x55, 0x56, 0x95, 0x96, 0x97, 0x9A, 0xA6, 0xAA, 0xAB },\n            new int[] { 0x44, 0x45, 0x54, 0x55, 0x59, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA9, 0xAA },\n            new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n            new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA },\n            new int[] { 0x45, 0x46, 0x55, 0x56, 0x5A, 0x95, 0x96, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB },\n            new int[] { 0x44, 0x45, 0x54, 0x55, 0x59, 0x95, 0x99, 0x9A, 0xA9, 0xAA },\n            new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA },\n            new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xAA },\n            new int[] { 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9B, 0xAA, 0xAB },\n            new int[] { 0x44, 0x45, 0x49, 0x54, 0x55, 0x58, 0x59, 0x95, 0x99, 0x9A, 0x9D, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x45, 0x49, 0x55, 0x59, 0x5A, 0x95, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9E, 0xAA, 0xAE },\n            new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x96, 0x99, 0x9A, 0x9B, 0x9E, 0xAA, 0xAB, 0xAE, 0xAF },\n            new int[] { 0x50, 0x51, 0x54, 0x55, 0x65, 0x95, 0x96, 0x99, 0xA5, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n            new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA },\n            new int[] { 0x51, 0x52, 0x55, 0x56, 0x66, 0x95, 0x96, 0x9A, 0xA6, 0xA7, 0xAA, 0xAB },\n            new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n            new int[] { 0x45, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n            new int[] { 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xEA },\n            new int[] { 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n            new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA },\n            new int[] { 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xEA },\n            new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xAB },\n            new int[] { 0x54, 0x55, 0x58, 0x59, 0x69, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAD, 0xAE },\n            new int[] { 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x96, 0x99, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n            new int[] { 0x50, 0x51, 0x54, 0x55, 0x65, 0x95, 0xA5, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xAA },\n            new int[] { 0x51, 0x52, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB },\n            new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA },\n            new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x51, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xAB },\n            new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA },\n            new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n            new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB },\n            new int[] { 0x54, 0x55, 0x58, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE },\n            new int[] { 0x54, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAE },\n            new int[] { 0x55, 0x56, 0x59, 0x5A, 0x66, 0x69, 0x6A, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xAF },\n            new int[] { 0x50, 0x51, 0x54, 0x55, 0x61, 0x64, 0x65, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xB5, 0xBA },\n            new int[] { 0x51, 0x55, 0x61, 0x65, 0x66, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA },\n            new int[] { 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0xB6, 0xBA },\n            new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x96, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB, 0xB6, 0xBA, 0xBB },\n            new int[] { 0x54, 0x55, 0x64, 0x65, 0x69, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA },\n            new int[] { 0x55, 0x65, 0x66, 0x69, 0x6A, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n            new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n            new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x96, 0xA5, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n            new int[] { 0x54, 0x55, 0x59, 0x64, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xB9, 0xBA },\n            new int[] { 0x54, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n            new int[] { 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n            new int[] { 0x55, 0x56, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xBA, 0xBB },\n            new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x99, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE, 0xB9, 0xBA, 0xBE },\n            new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x99, 0xA5, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n            new int[] { 0x55, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n            new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xBA },\n            new int[] { 0x40, 0x45, 0x51, 0x54, 0x55, 0x85, 0x91, 0x94, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n            new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x85, 0x91, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xAA, 0xEA },\n            new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x85, 0x91, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xD6, 0xEA },\n            new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x86, 0x92, 0x95, 0x96, 0x97, 0x9A, 0xA6, 0xAA, 0xAB, 0xD6, 0xEA, 0xEB },\n            new int[] { 0x44, 0x45, 0x54, 0x55, 0x59, 0x85, 0x94, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xEA },\n            new int[] { 0x45, 0x55, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xDA, 0xEA },\n            new int[] { 0x45, 0x55, 0x56, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xDA, 0xEA },\n            new int[] { 0x45, 0x55, 0x56, 0x86, 0x95, 0x96, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB, 0xDA, 0xEA, 0xEB },\n            new int[] { 0x44, 0x45, 0x54, 0x55, 0x59, 0x85, 0x94, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xD9, 0xEA },\n            new int[] { 0x45, 0x55, 0x59, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xDA, 0xEA },\n            new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xAA, 0xDA, 0xEA },\n            new int[] { 0x45, 0x55, 0x56, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB, 0xDA, 0xEA, 0xEB },\n            new int[] { 0x44, 0x45, 0x54, 0x55, 0x59, 0x89, 0x95, 0x98, 0x99, 0x9A, 0x9D, 0xA9, 0xAA, 0xAE, 0xD9, 0xEA, 0xEE },\n            new int[] { 0x45, 0x55, 0x59, 0x89, 0x95, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE, 0xDA, 0xEA, 0xEE },\n            new int[] { 0x45, 0x55, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE, 0xDA, 0xEA, 0xEE },\n            new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9B, 0x9E, 0xAA, 0xAB, 0xAE, 0xDA, 0xEA, 0xEF },\n            new int[] { 0x50, 0x51, 0x54, 0x55, 0x65, 0x91, 0x94, 0x95, 0x96, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n            new int[] { 0x51, 0x55, 0x91, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xE6, 0xEA },\n            new int[] { 0x51, 0x55, 0x56, 0x91, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xE6, 0xEA },\n            new int[] { 0x51, 0x55, 0x56, 0x92, 0x95, 0x96, 0x9A, 0xA6, 0xA7, 0xAA, 0xAB, 0xE6, 0xEA, 0xEB },\n            new int[] { 0x54, 0x55, 0x94, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xE9, 0xEA },\n            new int[] { 0x55, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n            new int[] { 0x55, 0x56, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n            new int[] { 0x55, 0x56, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB, 0xEA, 0xEB },\n            new int[] { 0x54, 0x55, 0x59, 0x94, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xE9, 0xEA },\n            new int[] { 0x55, 0x59, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n            new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n            new int[] { 0x45, 0x55, 0x56, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xAB, 0xEA, 0xEB },\n            new int[] { 0x54, 0x55, 0x59, 0x95, 0x98, 0x99, 0x9A, 0xA9, 0xAA, 0xAD, 0xAE, 0xE9, 0xEA, 0xEE },\n            new int[] { 0x55, 0x59, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE },\n            new int[] { 0x45, 0x55, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE },\n            new int[] { 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xAA, 0xAB, 0xAE, 0xEA, 0xEF },\n            new int[] { 0x50, 0x51, 0x54, 0x55, 0x65, 0x91, 0x94, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xE5, 0xEA },\n            new int[] { 0x51, 0x55, 0x65, 0x91, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xE6, 0xEA },\n            new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x91, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0xE6, 0xEA },\n            new int[] { 0x51, 0x55, 0x56, 0x66, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB, 0xE6, 0xEA, 0xEB },\n            new int[] { 0x54, 0x55, 0x65, 0x94, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xE9, 0xEA },\n            new int[] { 0x55, 0x65, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n            new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n            new int[] { 0x51, 0x55, 0x56, 0x66, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xAB, 0xEA, 0xEB },\n            new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x94, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xE9, 0xEA },\n            new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n            new int[] { 0x55, 0x56, 0x59, 0x65, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n            new int[] { 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xEA, 0xEB },\n            new int[] { 0x54, 0x55, 0x59, 0x69, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE, 0xE9, 0xEA, 0xEE },\n            new int[] { 0x54, 0x55, 0x59, 0x69, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE },\n            new int[] { 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE },\n            new int[] { 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xEA },\n            new int[] { 0x50, 0x51, 0x54, 0x55, 0x65, 0x95, 0xA1, 0xA4, 0xA5, 0xA6, 0xA9, 0xAA, 0xB5, 0xBA, 0xE5, 0xEA, 0xFA },\n            new int[] { 0x51, 0x55, 0x65, 0x95, 0xA1, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA, 0xE6, 0xEA, 0xFA },\n            new int[] { 0x51, 0x55, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA, 0xE6, 0xEA, 0xFA },\n            new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB, 0xB6, 0xBA, 0xE6, 0xEA, 0xFB },\n            new int[] { 0x54, 0x55, 0x65, 0x95, 0xA4, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA, 0xE9, 0xEA, 0xFA },\n            new int[] { 0x55, 0x65, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA },\n            new int[] { 0x51, 0x55, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA },\n            new int[] { 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0xAB, 0xBA, 0xEA, 0xFB },\n            new int[] { 0x54, 0x55, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA, 0xE9, 0xEA, 0xFA },\n            new int[] { 0x54, 0x55, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA },\n            new int[] { 0x55, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA },\n            new int[] { 0x55, 0x56, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xBA, 0xEA },\n            new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE, 0xB9, 0xBA, 0xE9, 0xEA, 0xFE },\n            new int[] { 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xAE, 0xBA, 0xEA, 0xFE },\n            new int[] { 0x55, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xBA, 0xEA },\n            new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xBA, 0xEA },\n        };\n        LatticeVertex4D[] latticeVerticesByCode = new LatticeVertex4D[256];\n        for (int i = 0; i < 256; i++)\n        {\n            int cx = ((i >> 0) & 3) - 1;\n            int cy = ((i >> 2) & 3) - 1;\n            int cz = ((i >> 4) & 3) - 1;\n            int cw = ((i >> 6) & 3) - 1;\n            latticeVerticesByCode[i] = new LatticeVertex4D(cx, cy, cz, cw);\n        }\n        int nLatticeVerticesTotal = 0;\n        for (int i = 0; i < 256; i++)\n        {\n            nLatticeVerticesTotal += lookup4DVertexCodes[i].Length;\n        }\n        LOOKUP_4D_A = new (short SecondaryIndexStart, short SecondaryIndexStop)[256];\n        LOOKUP_4D_B = new LatticeVertex4D[nLatticeVerticesTotal];\n        for (int i = 0, j = 0; i < 256; i++)\n        {\n            LOOKUP_4D_A[i] = ((short)j, (short)(j + lookup4DVertexCodes[i].Length));\n            for (int k = 0; k < lookup4DVertexCodes[i].Length; k++)\n            {\n                LOOKUP_4D_B[j++] = latticeVerticesByCode[lookup4DVertexCodes[i][k]];\n            }\n        }\n    }\n\n    private class LatticeVertex4D\n    {\n        public readonly float dx, dy, dz, dw;\n        public readonly long xsvp, ysvp, zsvp, wsvp;\n        public LatticeVertex4D(int xsv, int ysv, int zsv, int wsv)\n        {\n            this.xsvp = xsv * PRIME_X; this.ysvp = ysv * PRIME_Y;\n            this.zsvp = zsv * PRIME_Z; this.wsvp = wsv * PRIME_W;\n            float ssv = (xsv + ysv + zsv + wsv) * UNSKEW_4D;\n            this.dx = -xsv - ssv;\n            this.dy = -ysv - ssv;\n            this.dz = -zsv - ssv;\n            this.dw = -wsv - ssv;\n        }\n    }\n}\n"
  },
  {
    "path": "glsl/OpenSimplex2.glsl",
    "content": "//////////////// K.jpg's Re-oriented 4-Point BCC Noise (OpenSimplex2) ////////////////\n////////////////////// Output: vec4(dF/dx, dF/dy, dF/dz, value) //////////////////////\n\n// Inspired by Stefan Gustavson's noise\nvec4 permute(vec4 t) {\n    return t * (t * 34.0 + 133.0);\n}\n\n// Gradient set is a normalized expanded rhombic dodecahedron\nvec3 grad(float hash) {\n    \n    // Random vertex of a cube, +/- 1 each\n    vec3 cube = mod(floor(hash / vec3(1.0, 2.0, 4.0)), 2.0) * 2.0 - 1.0;\n    \n    // Random edge of the three edges connected to that vertex\n    // Also a cuboctahedral vertex\n    // And corresponds to the face of its dual, the rhombic dodecahedron\n    vec3 cuboct = cube;\n    cuboct[int(hash / 16.0)] = 0.0;\n    \n    // In a funky way, pick one of the four points on the rhombic face\n    float type = mod(floor(hash / 8.0), 2.0);\n    vec3 rhomb = (1.0 - type) * cube + type * (cuboct + cross(cube, cuboct));\n    \n    // Expand it so that the new edges are the same length\n    // as the existing ones\n    vec3 grad = cuboct * 1.22474487139 + rhomb;\n    \n    // To make all gradients the same length, we only need to shorten the\n    // second type of vector. We also put in the whole noise scale constant.\n    // The compiler should reduce it into the existing floats. I think.\n    grad *= (1.0 - 0.042942436724648037 * type) * 32.80201376986577;\n    \n    return grad;\n}\n\n// BCC lattice split up into 2 cube lattices\nvec4 openSimplex2Base(vec3 X) {\n    \n    // First half-lattice, closest edge\n    vec3 v1 = round(X);\n    vec3 d1 = X - v1;\n    vec3 score1 = abs(d1);\n    vec3 dir1 = step(max(score1.yzx, score1.zxy), score1);\n    vec3 v2 = v1 + dir1 * sign(d1);\n    vec3 d2 = X - v2;\n    \n    // Second half-lattice, closest edge\n    vec3 X2 = X + 144.5;\n    vec3 v3 = round(X2);\n    vec3 d3 = X2 - v3;\n    vec3 score2 = abs(d3);\n    vec3 dir2 = step(max(score2.yzx, score2.zxy), score2);\n    vec3 v4 = v3 + dir2 * sign(d3);\n    vec3 d4 = X2 - v4;\n    \n    // Gradient hashes for the four points, two from each half-lattice\n    vec4 hashes = permute(mod(vec4(v1.x, v2.x, v3.x, v4.x), 289.0));\n    hashes = permute(mod(hashes + vec4(v1.y, v2.y, v3.y, v4.y), 289.0));\n    hashes = mod(permute(mod(hashes + vec4(v1.z, v2.z, v3.z, v4.z), 289.0)), 48.0);\n    \n    // Gradient extrapolations & kernel function\n    vec4 a = max(0.5 - vec4(dot(d1, d1), dot(d2, d2), dot(d3, d3), dot(d4, d4)), 0.0);\n    vec4 aa = a * a; vec4 aaaa = aa * aa;\n    vec3 g1 = grad(hashes.x); vec3 g2 = grad(hashes.y);\n    vec3 g3 = grad(hashes.z); vec3 g4 = grad(hashes.w);\n    vec4 extrapolations = vec4(dot(d1, g1), dot(d2, g2), dot(d3, g3), dot(d4, g4));\n    \n    // Derivatives of the noise\n    vec3 derivative = -8.0 * mat4x3(d1, d2, d3, d4) * (aa * a * extrapolations)\n        + mat4x3(g1, g2, g3, g4) * aaaa;\n    \n    // Return it all as a vec4\n    return vec4(derivative, dot(aaaa, extrapolations));\n}\n\n// Use this if you don't want Z to look different from X and Y\nvec4 openSimplex2_Conventional(vec3 X) {\n    \n    // Rotate around the main diagonal. Not a skew transform.\n    vec4 result = openSimplex2Base(dot(X, vec3(2.0/3.0)) - X);\n    return vec4(dot(result.xyz, vec3(2.0/3.0)) - result.xyz, result.w);\n}\n\n// Use this if you want to show X and Y in a plane, then use Z for time, vertical, etc.\nvec4 openSimplex2_ImproveXY(vec3 X) {\n    \n    // Rotate so Z points down the main diagonal. Not a skew transform.\n    mat3 orthonormalMap = mat3(\n        0.788675134594813, -0.211324865405187, -0.577350269189626,\n        -0.211324865405187, 0.788675134594813, -0.577350269189626,\n        0.577350269189626, 0.577350269189626, 0.577350269189626);\n    \n    vec4 result = openSimplex2Base(orthonormalMap * X);\n    return vec4(result.xyz * orthonormalMap, result.w);\n}\n\n//////////////////////////////// End noise code ////////////////////////////////\n"
  },
  {
    "path": "glsl/OpenSimplex2S.glsl",
    "content": "/////////////// K.jpg's Re-oriented 8-Point BCC Noise (OpenSimplex2S) ////////////////\n////////////////////// Output: vec4(dF/dx, dF/dy, dF/dz, value) //////////////////////\n\n// Borrowed from Stefan Gustavson's noise code\nvec4 permute(vec4 t) {\n    return t * (t * 34.0 + 133.0);\n}\n\n// Gradient set is a normalized expanded rhombic dodecahedron\nvec3 grad(float hash) {\n    \n    // Random vertex of a cube, +/- 1 each\n    vec3 cube = mod(floor(hash / vec3(1.0, 2.0, 4.0)), 2.0) * 2.0 - 1.0;\n    \n    // Random edge of the three edges connected to that vertex\n    // Also a cuboctahedral vertex\n    // And corresponds to the face of its dual, the rhombic dodecahedron\n    vec3 cuboct = cube;\n    cuboct[int(hash / 16.0)] = 0.0;\n    \n    // In a funky way, pick one of the four points on the rhombic face\n    float type = mod(floor(hash / 8.0), 2.0);\n    vec3 rhomb = (1.0 - type) * cube + type * (cuboct + cross(cube, cuboct));\n    \n    // Expand it so that the new edges are the same length\n    // as the existing ones\n    vec3 grad = cuboct * 1.22474487139 + rhomb;\n    \n    // To make all gradients the same length, we only need to shorten the\n    // second type of vector. We also put in the whole noise scale constant.\n    // The compiler should reduce it into the existing floats. I think.\n    grad *= (1.0 - 0.042942436724648037 * type) * 3.5946317686139184;\n    \n    return grad;\n}\n\n// BCC lattice split up into 2 cube lattices\nvec4 openSimplex2SDerivativesPart(vec3 X) {\n    vec3 b = floor(X);\n    vec4 i4 = vec4(X - b, 2.5);\n    \n    // Pick between each pair of oppposite corners in the cube.\n    vec3 v1 = b + floor(dot(i4, vec4(.25)));\n    vec3 v2 = b + vec3(1, 0, 0) + vec3(-1, 1, 1) * floor(dot(i4, vec4(-.25, .25, .25, .35)));\n    vec3 v3 = b + vec3(0, 1, 0) + vec3(1, -1, 1) * floor(dot(i4, vec4(.25, -.25, .25, .35)));\n    vec3 v4 = b + vec3(0, 0, 1) + vec3(1, 1, -1) * floor(dot(i4, vec4(.25, .25, -.25, .35)));\n    \n    // Gradient hashes for the four vertices in this half-lattice.\n    vec4 hashes = permute(mod(vec4(v1.x, v2.x, v3.x, v4.x), 289.0));\n    hashes = permute(mod(hashes + vec4(v1.y, v2.y, v3.y, v4.y), 289.0));\n    hashes = mod(permute(mod(hashes + vec4(v1.z, v2.z, v3.z, v4.z), 289.0)), 48.0);\n    \n    // Gradient extrapolations & kernel function\n    vec3 d1 = X - v1; vec3 d2 = X - v2; vec3 d3 = X - v3; vec3 d4 = X - v4;\n    vec4 a = max(0.75 - vec4(dot(d1, d1), dot(d2, d2), dot(d3, d3), dot(d4, d4)), 0.0);\n    vec4 aa = a * a; vec4 aaaa = aa * aa;\n    vec3 g1 = grad(hashes.x); vec3 g2 = grad(hashes.y);\n    vec3 g3 = grad(hashes.z); vec3 g4 = grad(hashes.w);\n    vec4 extrapolations = vec4(dot(d1, g1), dot(d2, g2), dot(d3, g3), dot(d4, g4));\n    \n    // Derivatives of the noise\n    vec3 derivative = -8.0 * mat4x3(d1, d2, d3, d4) * (aa * a * extrapolations)\n        + mat4x3(g1, g2, g3, g4) * aaaa;\n    \n    // Return it all as a vec4\n    return vec4(derivative, dot(aaaa, extrapolations));\n}\n\n// Use this if you don't want Z to look different from X and Y\nvec4 openSimplex2SDerivatives_Conventional(vec3 X) {\n    X = dot(X, vec3(2.0/3.0)) - X;\n    \n    vec4 result = openSimplex2SDerivativesPart(X) + openSimplex2SDerivativesPart(X + 144.5);\n    \n    return vec4(dot(result.xyz, vec3(2.0/3.0)) - result.xyz, result.w);\n}\n\n// Use this if you want to show X and Y in a plane, then use Z for time, vertical, etc.\nvec4 openSimplex2SDerivatives_ImproveXY(vec3 X) {\n    \n    // Not a skew transform.\n    mat3 orthonormalMap = mat3(\n        0.788675134594813, -0.211324865405187, -0.577350269189626,\n        -0.211324865405187, 0.788675134594813, -0.577350269189626,\n        0.577350269189626, 0.577350269189626, 0.577350269189626);\n    \n    X = orthonormalMap * X;\n    vec4 result = openSimplex2SDerivativesPart(X) + openSimplex2SDerivativesPart(X + 144.5);\n    \n    return vec4(result.xyz * orthonormalMap, result.w);\n}\n\n//////////////////////////////// End noise code ////////////////////////////////\n"
  },
  {
    "path": "hlsl/OpenSimplex2.hlsl",
    "content": "#ifndef __bcc_noise_4_hlsl_\n#define __bcc_noise_4_hlsl_\n\n/////////////// K.jpg's Simplex-like Re-oriented 4-Point BCC Noise ///////////////\n//////////////////// Output: float4(dF/dx, dF/dy, dF/dz, value) ////////////////////\n\n// Inspired by Stefan Gustavson's noise\nfloat4 permute(float4 t) {\n\treturn t * (t * 34.0 + 133.0);\n}\n\n// https://stackoverflow.com/questions/7610631/glsl-mod-vs-hlsl-fmod\nfloat mod(float x, float y)\n{\n\treturn x - y * floor(x / y);\n}\n\nfloat2 mod(float2 x, float2 y)\n{\n\treturn x - y * floor(x / y);\n}\n\nfloat3 mod(float3 x, float3 y)\n{\n\treturn x - y * floor(x / y);\n}\n\nfloat4 mod(float4 x, float4 y)\n{\n\treturn x - y * floor(x / y);\n}\n\n// Gradient set is a normalized expanded rhombic dodecahedron\nfloat3 grad(float hash) {\n\t// Random vertex of a cube, +/- 1 each\n\tfloat3 cube = mod(floor(hash / float3(1.0, 2.0, 4.0)), 2.0) * 2.0 - 1.0;\n\n\t// Random edge of the three edges connected to that vertex\n\t// Also a cuboctahedral vertex\n\t// And corresponds to the face of its dual, the rhombic dodecahedron\n\tfloat3 cuboct = cube;\n\n\tint index = int(hash / 16.0);\n\n\tif (index == 0)\n\t\tcuboct.x = 0.0;\n\telse if (index == 1)\n\t\tcuboct.y = 0.0;\n\telse\n\t\tcuboct.z = 0.0;\n\n\t// In a funky way, pick one of the four points on the rhombic face\n\tfloat type = mod(floor(hash / 8.0), 2.0);\n\tfloat3 rhomb = (1.0 - type) * cube + type * (cuboct + cross(cube, cuboct));\n\n\t// Expand it so that the new edges are the same length\n\t// as the existing ones\n\tfloat3 grad = cuboct * 1.22474487139 + rhomb;\n\n\t// To make all gradients the same length, we only need to shorten the\n\t// second type of vector. We also put in the whole noise scale constant.\n\t// The compiler should reduce it into the existing floats. I think.\n\tgrad *= (1.0 - 0.042942436724648037 * type) * 32.80201376986577;\n\n\treturn grad;\n}\n\n// BCC lattice split up into 2 cube lattices\nfloat4 openSimplex2Base(float3 X) {\n\t// First half-lattice, closest edge\n\tfloat3 v1 = round(X);\n\tfloat3 d1 = X - v1;\n\tfloat3 score1 = abs(d1);\n\tfloat3 dir1 = step(max(score1.yzx, score1.zxy), score1);\n\tfloat3 v2 = v1 + dir1 * sign(d1);\n\tfloat3 d2 = X - v2;\n\n\t// Second half-lattice, closest edge\n\tfloat3 X2 = X + 144.5;\n\tfloat3 v3 = round(X2);\n\tfloat3 d3 = X2 - v3;\n\tfloat3 score2 = abs(d3);\n\tfloat3 dir2 = step(max(score2.yzx, score2.zxy), score2);\n\tfloat3 v4 = v3 + dir2 * sign(d3);\n\tfloat3 d4 = X2 - v4;\n\n\t// Gradient hashes for the four points, two from each half-lattice\n\tfloat4 hashes = permute(mod(float4(v1.x, v2.x, v3.x, v4.x), 289.0));\n\thashes = permute(mod(hashes + float4(v1.y, v2.y, v3.y, v4.y), 289.0));\n\thashes = mod(permute(mod(hashes + float4(v1.z, v2.z, v3.z, v4.z), 289.0)), 48.0);\n\n\t// Gradient extrapolations & kernel function\n\tfloat4 a = max(0.5 - float4(dot(d1, d1), dot(d2, d2), dot(d3, d3), dot(d4, d4)), 0.0);\n\tfloat4 aa = a * a; float4 aaaa = aa * aa;\n\tfloat3 g1 = grad(hashes.x); float3 g2 = grad(hashes.y);\n\tfloat3 g3 = grad(hashes.z); float3 g4 = grad(hashes.w);\n\tfloat4 extrapolations = float4(dot(d1, g1), dot(d2, g2), dot(d3, g3), dot(d4, g4));\n\n\tfloat4x3 derivativeMatrix = { d1, d2, d3, d4 };\n\tfloat4x3 gradientMatrix = { g1, g2, g3, g4 };\n\n\t// Derivatives of the noise\n\tfloat3 derivative = -8.0 * mul(aa * a * extrapolations, derivativeMatrix)\n\t\t+ mul(aaaa, gradientMatrix);\n\n\t// Return it all as a float4\n\treturn float4(derivative, dot(aaaa, extrapolations));\n}\n\n// Use this if you don't want Z to look different from X and Y\nfloat4 openSimplex2_Conventional(float3 X) {\n\t// Rotate around the main diagonal. Not a skew transform.\n\tfloat4 result = openSimplex2Base(dot(X, float3(2.0 / 3.0, 2.0 / 3.0, 2.0 / 3.0)) - X);\n\treturn float4(dot(result.xyz, float3(2.0 / 3.0, 2.0 / 3.0, 2.0 / 3.0)) - result.xyz, result.w);\n}\n\n// Use this if you want to show X and Y in a plane, then use Z for time, vertical, etc.\nfloat4 openSimplex2_ImproveXY(float3 X) {\n\t// Rotate so Z points down the main diagonal. Not a skew transform.\n\tfloat3x3 orthonormalMap = {\n\t\t0.788675134594813, -0.211324865405187, -0.577350269189626,\n\t\t\t-0.211324865405187, 0.788675134594813, -0.577350269189626,\n\t\t\t0.577350269189626, 0.577350269189626, 0.577350269189626 };\n\n\tfloat4 result = openSimplex2Base(mul(X, orthonormalMap));\n\treturn float4(mul(orthonormalMap, result.xyz), result.w);\n}\n\n//////////////////////////////// End noise code ////////////////////////////////\n\n#endif\n"
  },
  {
    "path": "hlsl/OpenSimplex2S.hlsl",
    "content": "#ifndef __bcc_noise_8_hlsl_\n#define __bcc_noise_8_hlsl_\n\n////////////////// K.jpg's Smooth Re-oriented 8-Point BCC Noise //////////////////\n//////////////////// Output: float4(dF/dx, dF/dy, dF/dz, value) ////////////////////\n\n// Borrowed from Stefan Gustavson's noise code\nfloat4 permute(float4 t) {\n\treturn t * (t * 34.0 + 133.0);\n}\n\nfloat mod(float x, float y)\n{\n\treturn x - y * floor(x / y);\n}\n\nfloat2 mod(float2 x, float2 y)\n{\n\treturn x - y * floor(x / y);\n}\n\nfloat3 mod(float3 x, float3 y)\n{\n\treturn x - y * floor(x / y);\n}\n\nfloat4 mod(float4 x, float4 y)\n{\n\treturn x - y * floor(x / y);\n}\n\n// Gradient set is a normalized expanded rhombic dodecahedron\nfloat3 grad(float hash) {\n\t// Random vertex of a cube, +/- 1 each\n\tfloat3 cube = mod(floor(hash / float3(1.0, 2.0, 4.0)), 2.0) * 2.0 - 1.0;\n\n\t// Random edge of the three edges connected to that vertex\n\t// Also a cuboctahedral vertex\n\t// And corresponds to the face of its dual, the rhombic dodecahedron\n\tfloat3 cuboct = cube;\n\n\tint index = int(hash / 16.0);\n\tif (index == 0)\n\t\tcuboct.x = 0.0;\n\telse if (index == 1)\n\t\tcuboct.y = 0.0;\n\telse\n\t\tcuboct.z = 0.0;\n\n\t// In a funky way, pick one of the four points on the rhombic face\n\tfloat type = mod(floor(hash / 8.0), 2.0);\n\tfloat3 rhomb = (1.0 - type) * cube + type * (cuboct + cross(cube, cuboct));\n\n\t// Expand it so that the new edges are the same length\n\t// as the existing ones\n\tfloat3 grad = cuboct * 1.22474487139 + rhomb;\n\n\t// To make all gradients the same length, we only need to shorten the\n\t// second type of vector. We also put in the whole noise scale constant.\n\t// The compiler should reduce it into the existing floats. I think.\n\tgrad *= (1.0 - 0.042942436724648037 * type) * 3.5946317686139184;\n\n\treturn grad;\n}\n\n// BCC lattice split up into 2 cube lattices\nfloat4 openSimplex2SDerivativesPart(float3 X) {\n\tfloat3 b = floor(X);\n\tfloat4 i4 = float4(X - b, 2.5);\n\n\t// Pick between each pair of oppposite corners in the cube.\n\tfloat3 v1 = b + floor(dot(i4, float4(.25, .25, .25, .25)));\n\tfloat3 v2 = b + float3(1, 0, 0) + float3(-1, 1, 1) * floor(dot(i4, float4(-.25, .25, .25, .35)));\n\tfloat3 v3 = b + float3(0, 1, 0) + float3(1, -1, 1) * floor(dot(i4, float4(.25, -.25, .25, .35)));\n\tfloat3 v4 = b + float3(0, 0, 1) + float3(1, 1, -1) * floor(dot(i4, float4(.25, .25, -.25, .35)));\n\n\t// Gradient hashes for the four vertices in this half-lattice.\n\tfloat4 hashes = permute(mod(float4(v1.x, v2.x, v3.x, v4.x), 289.0));\n\thashes = permute(mod(hashes + float4(v1.y, v2.y, v3.y, v4.y), 289.0));\n\thashes = mod(permute(mod(hashes + float4(v1.z, v2.z, v3.z, v4.z), 289.0)), 48.0);\n\n\t// Gradient extrapolations & kernel function\n\tfloat3 d1 = X - v1; float3 d2 = X - v2; float3 d3 = X - v3; float3 d4 = X - v4;\n\tfloat4 a = max(0.75 - float4(dot(d1, d1), dot(d2, d2), dot(d3, d3), dot(d4, d4)), 0.0);\n\tfloat4 aa = a * a; float4 aaaa = aa * aa;\n\tfloat3 g1 = grad(hashes.x); float3 g2 = grad(hashes.y);\n\tfloat3 g3 = grad(hashes.z); float3 g4 = grad(hashes.w);\n\tfloat4 extrapolations = float4(dot(d1, g1), dot(d2, g2), dot(d3, g3), dot(d4, g4));\n\n\tfloat4x3 derivativeMatrix = { d1, d2, d3, d4 };\n\tfloat4x3 gradientMatrix = { g1, g2, g3, g4 };\n\n\t// Derivatives of the noise\n\tfloat3 derivative = -8.0 * mul(aa * a * extrapolations, derivativeMatrix)\n\t\t+ mul(aaaa, gradientMatrix);\n\n\t// Return it all as a float4\n\treturn float4(derivative, dot(aaaa, extrapolations));\n}\n\n// Use this if you don't want Z to look different from X and Y\nfloat4 openSimplex2SDerivatives_Conventional(float3 X) {\n\tX = dot(X, float3(2.0 / 3.0, 2.0 / 3.0, 2.0 / 3.0)) - X;\n\n\tfloat4 result = openSimplex2SDerivativesPart(X) + openSimplex2SDerivativesPart(X + 144.5);\n\n\treturn float4(dot(result.xyz, float3(2.0 / 3.0, 2.0 / 3.0, 2.0 / 3.0)) - result.xyz, result.w);\n}\n\n// Use this if you want to show X and Y in a plane, then use Z for time, vertical, etc.\nfloat4 openSimplex2SDerivatives_ImproveXY(float3 X) {\n\t// Not a skew transform.\n\tfloat3x3 orthonormalMap = {\n\t\t0.788675134594813, -0.211324865405187, -0.577350269189626,\n\t\t-0.211324865405187, 0.788675134594813, -0.577350269189626,\n\t\t0.577350269189626, 0.577350269189626, 0.577350269189626 };\n\n\tX = mul(X, orthonormalMap);\n\tfloat4 result = openSimplex2SDerivativesPart(X) + openSimplex2SDerivativesPart(X + 144.5);\n\n\treturn float4(mul(orthonormalMap, result.xyz), result.w);\n}\n\n//////////////////////////////// End noise code ////////////////////////////////\n\n#endif\n"
  },
  {
    "path": "hlsl/UNLICENSE",
    "content": "This is free and unencumbered software released into the public domain.\n\nAnyone is free to copy, modify, publish, use, compile, sell, or\ndistribute this software, either in source code form or as a compiled\nbinary, for any purpose, commercial or non-commercial, and by any\nmeans.\n\nIn jurisdictions that recognize copyright laws, the author or authors\nof this software dedicate any and all copyright interest in the\nsoftware to the public domain. We make this dedication for the benefit\nof the public at large and to the detriment of our heirs and\nsuccessors. We intend this dedication to be an overt act of\nrelinquishment in perpetuity of all present and future rights to this\nsoftware under copyright law.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR\nOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\nFor more information, please refer to <https://unlicense.org>\n"
  },
  {
    "path": "java/OpenSimplex2.java",
    "content": "/**\n * K.jpg's OpenSimplex 2, faster variant\n */\n\npublic class OpenSimplex2 {\n\n    private static final long PRIME_X = 0x5205402B9270C86FL;\n    private static final long PRIME_Y = 0x598CD327003817B5L;\n    private static final long PRIME_Z = 0x5BCC226E9FA0BACBL;\n    private static final long PRIME_W = 0x56CC5227E58F554BL;\n    private static final long HASH_MULTIPLIER = 0x53A3F72DEEC546F5L;\n    private static final long SEED_FLIP_3D = -0x52D547B2E96ED629L;\n    private static final long SEED_OFFSET_4D = 0xE83DC3E0DA7164DL;\n\n    private static final double ROOT2OVER2 = 0.7071067811865476;\n    private static final double SKEW_2D = 0.366025403784439;\n    private static final double UNSKEW_2D = -0.21132486540518713;\n\n    private static final double ROOT3OVER3 = 0.577350269189626;\n    private static final double FALLBACK_ROTATE_3D = 2.0 / 3.0;\n    private static final double ROTATE_3D_ORTHOGONALIZER = UNSKEW_2D;\n\n    private static final float SKEW_4D = -0.138196601125011f;\n    private static final float UNSKEW_4D = 0.309016994374947f;\n    private static final float LATTICE_STEP_4D = 0.2f;\n\n    private static final int N_GRADS_2D_EXPONENT = 7;\n    private static final int N_GRADS_3D_EXPONENT = 8;\n    private static final int N_GRADS_4D_EXPONENT = 9;\n    private static final int N_GRADS_2D = 1 << N_GRADS_2D_EXPONENT;\n    private static final int N_GRADS_3D = 1 << N_GRADS_3D_EXPONENT;\n    private static final int N_GRADS_4D = 1 << N_GRADS_4D_EXPONENT;\n\n    private static final double NORMALIZER_2D = 0.01001634121365712;\n    private static final double NORMALIZER_3D = 0.07969837668935331;\n    private static final double NORMALIZER_4D = 0.0220065933241897;\n\n    private static final float RSQUARED_2D = 0.5f;\n    private static final float RSQUARED_3D = 0.6f;\n    private static final float RSQUARED_4D = 0.6f;\n\n\n    /*\n     * Noise Evaluators\n     */\n\n    /**\n     * 2D Simplex noise, standard lattice orientation.\n     */\n    public static float noise2(long seed, double x, double y) {\n\n        // Get points for A2* lattice\n        double s = SKEW_2D * (x + y);\n        double xs = x + s, ys = y + s;\n\n        return noise2_UnskewedBase(seed, xs, ys);\n    }\n\n    /**\n     * 2D Simplex noise, with Y pointing down the main diagonal.\n     * Might be better for a 2D sandbox style game, where Y is vertical.\n     * Probably slightly less optimal for heightmaps or continent maps,\n     * unless your map is centered around an equator. It's a subtle\n     * difference, but the option is here to make it an easy choice.\n     */\n    public static float noise2_ImproveX(long seed, double x, double y) {\n\n        // Skew transform and rotation baked into one.\n        double xx = x * ROOT2OVER2;\n        double yy = y * (ROOT2OVER2 * (1 + 2 * SKEW_2D));\n\n        return noise2_UnskewedBase(seed, yy + xx, yy - xx);\n    }\n\n    /**\n     * 2D Simplex noise base.\n     */\n    private static float noise2_UnskewedBase(long seed, double xs, double ys) {\n\n        // Get base points and offsets.\n        int xsb = fastFloor(xs), ysb = fastFloor(ys);\n        float xi = (float)(xs - xsb), yi = (float)(ys - ysb);\n\n        // Prime pre-multiplication for hash.\n        long xsbp = xsb * PRIME_X, ysbp = ysb * PRIME_Y;\n\n        // Unskew.\n        float t = (xi + yi) * (float)UNSKEW_2D;\n        float dx0 = xi + t, dy0 = yi + t;\n\n        // First vertex.\n        float value = 0;\n        float a0 = RSQUARED_2D - dx0 * dx0 - dy0 * dy0;\n        if (a0 > 0) {\n            value = (a0 * a0) * (a0 * a0) * grad(seed, xsbp, ysbp, dx0, dy0);\n        }\n\n        // Second vertex.\n        float a1 = (float)(2 * (1 + 2 * UNSKEW_2D) * (1 / UNSKEW_2D + 2)) * t + ((float)(-2 * (1 + 2 * UNSKEW_2D) * (1 + 2 * UNSKEW_2D)) + a0);\n        if (a1 > 0) {\n            float dx1 = dx0 - (float)(1 + 2 * UNSKEW_2D);\n            float dy1 = dy0 - (float)(1 + 2 * UNSKEW_2D);\n            value += (a1 * a1) * (a1 * a1) * grad(seed, xsbp + PRIME_X, ysbp + PRIME_Y, dx1, dy1);\n        }\n\n        // Third vertex.\n        if (dy0 > dx0) {\n            float dx2 = dx0 - (float)UNSKEW_2D;\n            float dy2 = dy0 - (float)(UNSKEW_2D + 1);\n            float a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n            if (a2 > 0) {\n                value += (a2 * a2) * (a2 * a2) * grad(seed, xsbp, ysbp + PRIME_Y, dx2, dy2);\n            }\n        }\n        else\n        {\n            float dx2 = dx0 - (float)(UNSKEW_2D + 1);\n            float dy2 = dy0 - (float)UNSKEW_2D;\n            float a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n            if (a2 > 0) {\n                value += (a2 * a2) * (a2 * a2) * grad(seed, xsbp + PRIME_X, ysbp, dx2, dy2);\n            }\n        }\n\n        return value;\n    }\n\n    /**\n     * 3D OpenSimplex2 noise, with better visual isotropy in (X, Y).\n     * Recommended for 3D terrain and time-varied animations.\n     * The Z coordinate should always be the \"different\" coordinate in whatever your use case is.\n     * If Y is vertical in world coordinates, call noise3_ImproveXZ(x, z, Y) or use noise3_XZBeforeY.\n     * If Z is vertical in world coordinates, call noise3_ImproveXZ(x, y, Z).\n     * For a time varied animation, call noise3_ImproveXY(x, y, T).\n     */\n    public static float noise3_ImproveXY(long seed, double x, double y, double z) {\n\n        // Re-orient the cubic lattices without skewing, so Z points up the main lattice diagonal,\n        // and the planes formed by XY are moved far out of alignment with the cube faces.\n        // Orthonormal rotation. Not a skew transform.\n        double xy = x + y;\n        double s2 = xy * ROTATE_3D_ORTHOGONALIZER;\n        double zz = z * ROOT3OVER3;\n        double xr = x + s2 + zz;\n        double yr = y + s2 + zz;\n        double zr = xy * -ROOT3OVER3 + zz;\n\n        // Evaluate both lattices to form a BCC lattice.\n        return noise3_UnrotatedBase(seed, xr, yr, zr);\n    }\n\n    /**\n     * 3D OpenSimplex2 noise, with better visual isotropy in (X, Z).\n     * Recommended for 3D terrain and time-varied animations.\n     * The Y coordinate should always be the \"different\" coordinate in whatever your use case is.\n     * If Y is vertical in world coordinates, call noise3_ImproveXZ(x, Y, z).\n     * If Z is vertical in world coordinates, call noise3_ImproveXZ(x, Z, y) or use noise3_ImproveXY.\n     * For a time varied animation, call noise3_ImproveXZ(x, T, y) or use noise3_ImproveXY.\n     */\n    public static float noise3_ImproveXZ(long seed, double x, double y, double z) {\n\n        // Re-orient the cubic lattices without skewing, so Y points up the main lattice diagonal,\n        // and the planes formed by XZ are moved far out of alignment with the cube faces.\n        // Orthonormal rotation. Not a skew transform.\n        double xz = x + z;\n        double s2 = xz * ROTATE_3D_ORTHOGONALIZER;\n        double yy = y * ROOT3OVER3;\n        double xr = x + s2 + yy;\n        double zr = z + s2 + yy;\n        double yr = xz * -ROOT3OVER3 + yy;\n\n        // Evaluate both lattices to form a BCC lattice.\n        return noise3_UnrotatedBase(seed, xr, yr, zr);\n    }\n\n    /**\n     * 3D OpenSimplex2 noise, fallback rotation option\n     * Use noise3_ImproveXY or noise3_ImproveXZ instead, wherever appropriate.\n     * They have less diagonal bias. This function's best use is as a fallback.\n     */\n    public static float noise3_Fallback(long seed, double x, double y, double z) {\n\n        // Re-orient the cubic lattices via rotation, to produce a familiar look.\n        // Orthonormal rotation. Not a skew transform.\n        double r = FALLBACK_ROTATE_3D * (x + y + z);\n        double xr = r - x, yr = r - y, zr = r - z;\n\n        // Evaluate both lattices to form a BCC lattice.\n        return noise3_UnrotatedBase(seed, xr, yr, zr);\n    }\n\n    /**\n     * Generate overlapping cubic lattices for 3D OpenSimplex2 noise.\n     */\n    private static float noise3_UnrotatedBase(long seed, double xr, double yr, double zr) {\n\n        // Get base points and offsets.\n        int xrb = fastRound(xr), yrb = fastRound(yr), zrb = fastRound(zr);\n        float xri = (float)(xr - xrb), yri = (float)(yr - yrb), zri = (float)(zr - zrb);\n\n        // -1 if positive, 1 if negative.\n        int xNSign = (int)(-1.0f - xri) | 1, yNSign = (int)(-1.0f - yri) | 1, zNSign = (int)(-1.0f - zri) | 1;\n\n        // Compute absolute values, using the above as a shortcut. This was faster in my tests for some reason.\n        float ax0 = xNSign * -xri, ay0 = yNSign * -yri, az0 = zNSign * -zri;\n\n        // Prime pre-multiplication for hash.\n        long xrbp = xrb * PRIME_X, yrbp = yrb * PRIME_Y, zrbp = zrb * PRIME_Z;\n\n        // Loop: Pick an edge on each lattice copy.\n        float value = 0;\n        float a = (RSQUARED_3D - xri * xri) - (yri * yri + zri * zri);\n        for (int l = 0; ; l++) {\n\n            // Closest point on cube.\n            if (a > 0) {\n                value += (a * a) * (a * a) * grad(seed, xrbp, yrbp, zrbp, xri, yri, zri);\n            }\n\n            // Second-closest point.\n            if (ax0 >= ay0 && ax0 >= az0) {\n                float b = a + ax0 + ax0;\n                if (b > 1) {\n                    b -= 1;\n                    value += (b * b) * (b * b) * grad(seed, xrbp - xNSign * PRIME_X, yrbp, zrbp, xri + xNSign, yri, zri);\n                }\n            }\n            else if (ay0 > ax0 && ay0 >= az0) {\n                float b = a + ay0 + ay0;\n                if (b > 1) {\n                    b -= 1;\n                    value += (b * b) * (b * b) * grad(seed, xrbp, yrbp - yNSign * PRIME_Y, zrbp, xri, yri + yNSign, zri);\n                }\n            }\n            else\n            {\n                float b = a + az0 + az0;\n                if (b > 1) {\n                    b -= 1;\n                    value += (b * b) * (b * b) * grad(seed, xrbp, yrbp, zrbp - zNSign * PRIME_Z, xri, yri, zri + zNSign);\n                }\n            }\n\n            // Break from loop if we're done, skipping updates below.\n            if (l == 1) break;\n\n            // Update absolute value.\n            ax0 = 0.5f - ax0;\n            ay0 = 0.5f - ay0;\n            az0 = 0.5f - az0;\n\n            // Update relative coordinate.\n            xri = xNSign * ax0;\n            yri = yNSign * ay0;\n            zri = zNSign * az0;\n\n            // Update falloff.\n            a += (0.75f - ax0) - (ay0 + az0);\n\n            // Update prime for hash.\n            xrbp += (xNSign >> 1) & PRIME_X;\n            yrbp += (yNSign >> 1) & PRIME_Y;\n            zrbp += (zNSign >> 1) & PRIME_Z;\n\n            // Update the reverse sign indicators.\n            xNSign = -xNSign;\n            yNSign = -yNSign;\n            zNSign = -zNSign;\n\n            // And finally update the seed for the other lattice copy.\n            seed ^= SEED_FLIP_3D;\n        }\n\n        return value;\n    }\n\n    /**\n     * 4D OpenSimplex2 noise, with XYZ oriented like noise3_ImproveXY\n     * and W for an extra degree of freedom. W repeats eventually.\n     * Recommended for time-varied animations which texture a 3D object (W=time)\n     * in a space where Z is vertical\n     */\n    public static float noise4_ImproveXYZ_ImproveXY(long seed, double x, double y, double z, double w) {\n\n        double xy = x + y;\n        double s2 = xy * -0.21132486540518699998;\n        double zz = z * 0.28867513459481294226;\n        double ww = w * 0.2236067977499788;\n        double xr = x + (zz + ww + s2), yr = y + (zz + ww + s2);\n        double zr = xy * -0.57735026918962599998 + (zz + ww);\n        double wr = z * -0.866025403784439 + ww;\n\n        return noise4_UnskewedBase(seed, xr, yr, zr, wr);\n    }\n\n    /**\n     * 4D OpenSimplex2 noise, with XYZ oriented like noise3_ImproveXZ\n     * and W for an extra degree of freedom. W repeats eventually.\n     * Recommended for time-varied animations which texture a 3D object (W=time)\n     * in a space where Y is vertical\n     */\n    public static float noise4_ImproveXYZ_ImproveXZ(long seed, double x, double y, double z, double w) {\n\n        double xz = x + z;\n        double s2 = xz * -0.21132486540518699998;\n        double yy = y * 0.28867513459481294226;\n        double ww = w * 0.2236067977499788;\n        double xr = x + (yy + ww + s2), zr = z + (yy + ww + s2);\n        double yr = xz * -0.57735026918962599998 + (yy + ww);\n        double wr = y * -0.866025403784439 + ww;\n\n        return noise4_UnskewedBase(seed, xr, yr, zr, wr);\n    }\n\n    /**\n     * 4D OpenSimplex2 noise, with XYZ oriented like noise3_Fallback\n     * and W for an extra degree of freedom. W repeats eventually.\n     * Recommended for time-varied animations which texture a 3D object (W=time)\n     * where there isn't a clear distinction between horizontal and vertical\n     */\n    public static float noise4_ImproveXYZ(long seed, double x, double y, double z, double w) {\n\n        double xyz = x + y + z;\n        double ww = w * 0.2236067977499788;\n        double s2 = xyz * -0.16666666666666666 + ww;\n        double xs = x + s2, ys = y + s2, zs = z + s2, ws = -0.5 * xyz + ww;\n\n        return noise4_UnskewedBase(seed, xs, ys, zs, ws);\n    }\n    \n    /**\n     * 4D OpenSimplex2 noise, with XY and ZW forming orthogonal triangular-based planes.\n     * Recommended for 3D terrain, where X and Y (or Z and W) are horizontal.\n     * Recommended for noise(x, y, sin(time), cos(time)) trick.\n     */\n    public static float noise4_ImproveXY_ImproveZW(long seed, double x, double y, double z, double w) {\n        \n        double s2 = (x + y) * -0.178275657951399372 + (z + w) * 0.215623393288842828;\n        double t2 = (z + w) * -0.403949762580207112 + (x + y) * -0.375199083010075342;\n        double xs = x + s2, ys = y + s2, zs = z + t2, ws = w + t2;\n        \n        return noise4_UnskewedBase(seed, xs, ys, zs, ws);\n    }\n\n    /**\n     * 4D OpenSimplex2 noise, fallback lattice orientation.\n     */\n    public static float noise4_Fallback(long seed, double x, double y, double z, double w) {\n\n        // Get points for A4 lattice\n        double s = SKEW_4D * (x + y + z + w);\n        double xs = x + s, ys = y + s, zs = z + s, ws = w + s;\n\n        return noise4_UnskewedBase(seed, xs, ys, zs, ws);\n    }\n\n    /**\n     * 4D OpenSimplex2 noise base.\n     */\n    private static float noise4_UnskewedBase(long seed, double xs, double ys, double zs, double ws) {\n\n        // Get base points and offsets\n        int xsb = fastFloor(xs), ysb = fastFloor(ys), zsb = fastFloor(zs), wsb = fastFloor(ws);\n        float xsi = (float)(xs - xsb), ysi = (float)(ys - ysb), zsi = (float)(zs - zsb), wsi = (float)(ws - wsb);\n\n        // Determine which lattice we can be confident has a contributing point its corresponding cell's base simplex.\n        // We only look at the spaces between the diagonal planes. This proved effective in all of my tests.\n        float siSum = (xsi + ysi) + (zsi + wsi);\n        int startingLattice = (int)(siSum * 1.25);\n\n        // Offset for seed based on first lattice copy.\n        seed += startingLattice * SEED_OFFSET_4D;\n\n        // Offset for lattice point relative positions (skewed)\n        float startingLatticeOffset = startingLattice * -LATTICE_STEP_4D;\n        xsi += startingLatticeOffset; ysi += startingLatticeOffset; zsi += startingLatticeOffset; wsi += startingLatticeOffset;\n\n        // Prep for vertex contributions.\n        float ssi = (siSum + startingLatticeOffset * 4) * UNSKEW_4D;\n\n        // Prime pre-multiplication for hash.\n        long xsvp = xsb * PRIME_X, ysvp = ysb * PRIME_Y, zsvp = zsb * PRIME_Z, wsvp = wsb * PRIME_W;\n\n        // Five points to add, total, from five copies of the A4 lattice.\n        float value = 0;\n        for (int i = 0; ; i++) {\n\n            // Next point is the closest vertex on the 4-simplex whose base vertex is the aforementioned vertex.\n            double score0 = 1.0 + ssi * (-1.0 / UNSKEW_4D); // Seems slightly faster than 1.0-xsi-ysi-zsi-wsi\n            if (xsi >= ysi && xsi >= zsi && xsi >= wsi && xsi >= score0) {\n                xsvp += PRIME_X;\n                xsi -= 1;\n                ssi -= UNSKEW_4D;\n            }\n            else if (ysi > xsi && ysi >= zsi && ysi >= wsi && ysi >= score0) {\n                ysvp += PRIME_Y;\n                ysi -= 1;\n                ssi -= UNSKEW_4D;\n            }\n            else if (zsi > xsi && zsi > ysi && zsi >= wsi && zsi >= score0) {\n                zsvp += PRIME_Z;\n                zsi -= 1;\n                ssi -= UNSKEW_4D;\n            }\n            else if (wsi > xsi && wsi > ysi && wsi > zsi && wsi >= score0) {\n                wsvp += PRIME_W;\n                wsi -= 1;\n                ssi -= UNSKEW_4D;\n            }\n\n            // gradient contribution with falloff.\n            float dx = xsi + ssi, dy = ysi + ssi, dz = zsi + ssi, dw = wsi + ssi;\n            float a = (dx * dx + dy * dy) + (dz * dz + dw * dw);\n            if (a < RSQUARED_4D) {\n                a -= RSQUARED_4D;\n                a *= a;\n                value += a * a * grad(seed, xsvp, ysvp, zsvp, wsvp, dx, dy, dz, dw);\n            }\n\n            // Break from loop if we're done, skipping updates below.\n            if (i == 4) break;\n\n            // Update for next lattice copy shifted down by <-0.2, -0.2, -0.2, -0.2>.\n            xsi += LATTICE_STEP_4D; ysi += LATTICE_STEP_4D; zsi += LATTICE_STEP_4D; wsi += LATTICE_STEP_4D;\n            ssi += LATTICE_STEP_4D * 4 * UNSKEW_4D;\n            seed -= SEED_OFFSET_4D;\n\n            // Because we don't always start on the same lattice copy, there's a special reset case.\n            if (i == startingLattice) {\n                xsvp -= PRIME_X;\n                ysvp -= PRIME_Y;\n                zsvp -= PRIME_Z;\n                wsvp -= PRIME_W;\n                seed += SEED_OFFSET_4D * 5;\n            }\n        }\n\n        return value;\n    }\n\n    /*\n     * Utility\n     */\n\n    private static float grad(long seed, long xsvp, long ysvp, float dx, float dy) {\n        long hash = seed ^ xsvp ^ ysvp;\n        hash *= HASH_MULTIPLIER;\n        hash ^= hash >> (64 - N_GRADS_2D_EXPONENT + 1);\n        int gi = (int)hash & ((N_GRADS_2D - 1) << 1);\n        return GRADIENTS_2D[gi | 0] * dx + GRADIENTS_2D[gi | 1] * dy;\n    }\n\n    private static float grad(long seed, long xrvp, long yrvp, long zrvp, float dx, float dy, float dz) {\n        long hash = (seed ^ xrvp) ^ (yrvp ^ zrvp);\n        hash *= HASH_MULTIPLIER;\n        hash ^= hash >> (64 - N_GRADS_3D_EXPONENT + 2);\n        int gi = (int)hash & ((N_GRADS_3D - 1) << 2);\n        return GRADIENTS_3D[gi | 0] * dx + GRADIENTS_3D[gi | 1] * dy + GRADIENTS_3D[gi | 2] * dz;\n    }\n\n    private static float grad(long seed, long xsvp, long ysvp, long zsvp, long wsvp, float dx, float dy, float dz, float dw) {\n        long hash = seed ^ (xsvp ^ ysvp) ^ (zsvp ^ wsvp);\n        hash *= HASH_MULTIPLIER;\n        hash ^= hash >> (64 - N_GRADS_4D_EXPONENT + 2);\n        int gi = (int)hash & ((N_GRADS_4D - 1) << 2);\n        return (GRADIENTS_4D[gi | 0] * dx + GRADIENTS_4D[gi | 1] * dy) + (GRADIENTS_4D[gi | 2] * dz + GRADIENTS_4D[gi | 3] * dw);\n    }\n\n    private static int fastFloor(double x) {\n        int xi = (int)x;\n        return x < xi ? xi - 1 : xi;\n    }\n\n    private static int fastRound(double x) {\n        return x < 0 ? (int)(x - 0.5) : (int)(x + 0.5);\n    }\n\n    /*\n     * gradients\n     */\n\n    private static float[] GRADIENTS_2D;\n    private static float[] GRADIENTS_3D;\n    private static float[] GRADIENTS_4D;\n    static {\n\n        GRADIENTS_2D = new float[N_GRADS_2D * 2];\n        float[] grad2 = {\n             0.38268343236509f,   0.923879532511287f,\n             0.923879532511287f,  0.38268343236509f,\n             0.923879532511287f, -0.38268343236509f,\n             0.38268343236509f,  -0.923879532511287f,\n            -0.38268343236509f,  -0.923879532511287f,\n            -0.923879532511287f, -0.38268343236509f,\n            -0.923879532511287f,  0.38268343236509f,\n            -0.38268343236509f,   0.923879532511287f,\n            //-------------------------------------//\n             0.130526192220052f,  0.99144486137381f,\n             0.608761429008721f,  0.793353340291235f,\n             0.793353340291235f,  0.608761429008721f,\n             0.99144486137381f,   0.130526192220051f,\n             0.99144486137381f,  -0.130526192220051f,\n             0.793353340291235f, -0.60876142900872f,\n             0.608761429008721f, -0.793353340291235f,\n             0.130526192220052f, -0.99144486137381f,\n            -0.130526192220052f, -0.99144486137381f,\n            -0.608761429008721f, -0.793353340291235f,\n            -0.793353340291235f, -0.608761429008721f,\n            -0.99144486137381f,  -0.130526192220052f,\n            -0.99144486137381f,   0.130526192220051f,\n            -0.793353340291235f,  0.608761429008721f,\n            -0.608761429008721f,  0.793353340291235f,\n            -0.130526192220052f,  0.99144486137381f,\n        };\n        for (int i = 0; i < grad2.length; i++) {\n            grad2[i] = (float)(grad2[i] / NORMALIZER_2D);\n        }\n        for (int i = 0, j = 0; i < GRADIENTS_2D.length; i++, j++) {\n            if (j == grad2.length) j = 0;\n            GRADIENTS_2D[i] = grad2[j];\n        }\n\n        GRADIENTS_3D = new float[N_GRADS_3D * 4];\n        float[] grad3 = {\n             2.22474487139f,       2.22474487139f,      -1.0f,                 0.0f,\n             2.22474487139f,       2.22474487139f,       1.0f,                 0.0f,\n             3.0862664687972017f,  1.1721513422464978f,  0.0f,                 0.0f,\n             1.1721513422464978f,  3.0862664687972017f,  0.0f,                 0.0f,\n            -2.22474487139f,       2.22474487139f,      -1.0f,                 0.0f,\n            -2.22474487139f,       2.22474487139f,       1.0f,                 0.0f,\n            -1.1721513422464978f,  3.0862664687972017f,  0.0f,                 0.0f,\n            -3.0862664687972017f,  1.1721513422464978f,  0.0f,                 0.0f,\n            -1.0f,                -2.22474487139f,      -2.22474487139f,       0.0f,\n             1.0f,                -2.22474487139f,      -2.22474487139f,       0.0f,\n             0.0f,                -3.0862664687972017f, -1.1721513422464978f,  0.0f,\n             0.0f,                -1.1721513422464978f, -3.0862664687972017f,  0.0f,\n            -1.0f,                -2.22474487139f,       2.22474487139f,       0.0f,\n             1.0f,                -2.22474487139f,       2.22474487139f,       0.0f,\n             0.0f,                -1.1721513422464978f,  3.0862664687972017f,  0.0f,\n             0.0f,                -3.0862664687972017f,  1.1721513422464978f,  0.0f,\n            //--------------------------------------------------------------------//\n            -2.22474487139f,      -2.22474487139f,      -1.0f,                 0.0f,\n            -2.22474487139f,      -2.22474487139f,       1.0f,                 0.0f,\n            -3.0862664687972017f, -1.1721513422464978f,  0.0f,                 0.0f,\n            -1.1721513422464978f, -3.0862664687972017f,  0.0f,                 0.0f,\n            -2.22474487139f,      -1.0f,                -2.22474487139f,       0.0f,\n            -2.22474487139f,       1.0f,                -2.22474487139f,       0.0f,\n            -1.1721513422464978f,  0.0f,                -3.0862664687972017f,  0.0f,\n            -3.0862664687972017f,  0.0f,                -1.1721513422464978f,  0.0f,\n            -2.22474487139f,      -1.0f,                 2.22474487139f,       0.0f,\n            -2.22474487139f,       1.0f,                 2.22474487139f,       0.0f,\n            -3.0862664687972017f,  0.0f,                 1.1721513422464978f,  0.0f,\n            -1.1721513422464978f,  0.0f,                 3.0862664687972017f,  0.0f,\n            -1.0f,                 2.22474487139f,      -2.22474487139f,       0.0f,\n             1.0f,                 2.22474487139f,      -2.22474487139f,       0.0f,\n             0.0f,                 1.1721513422464978f, -3.0862664687972017f,  0.0f,\n             0.0f,                 3.0862664687972017f, -1.1721513422464978f,  0.0f,\n            -1.0f,                 2.22474487139f,       2.22474487139f,       0.0f,\n             1.0f,                 2.22474487139f,       2.22474487139f,       0.0f,\n             0.0f,                 3.0862664687972017f,  1.1721513422464978f,  0.0f,\n             0.0f,                 1.1721513422464978f,  3.0862664687972017f,  0.0f,\n             2.22474487139f,      -2.22474487139f,      -1.0f,                 0.0f,\n             2.22474487139f,      -2.22474487139f,       1.0f,                 0.0f,\n             1.1721513422464978f, -3.0862664687972017f,  0.0f,                 0.0f,\n             3.0862664687972017f, -1.1721513422464978f,  0.0f,                 0.0f,\n             2.22474487139f,      -1.0f,                -2.22474487139f,       0.0f,\n             2.22474487139f,       1.0f,                -2.22474487139f,       0.0f,\n             3.0862664687972017f,  0.0f,                -1.1721513422464978f,  0.0f,\n             1.1721513422464978f,  0.0f,                -3.0862664687972017f,  0.0f,\n             2.22474487139f,      -1.0f,                 2.22474487139f,       0.0f,\n             2.22474487139f,       1.0f,                 2.22474487139f,       0.0f,\n             1.1721513422464978f,  0.0f,                 3.0862664687972017f,  0.0f,\n             3.0862664687972017f,  0.0f,                 1.1721513422464978f,  0.0f,\n        };\n        for (int i = 0; i < grad3.length; i++) {\n            grad3[i] = (float)(grad3[i] / NORMALIZER_3D);\n        }\n        for (int i = 0, j = 0; i < GRADIENTS_3D.length; i++, j++) {\n            if (j == grad3.length) j = 0;\n            GRADIENTS_3D[i] = grad3[j];\n        }\n\n        GRADIENTS_4D = new float[N_GRADS_4D * 4];\n        float[] grad4 = {\n            -0.6740059517812944f,   -0.3239847771997537f,   -0.3239847771997537f,    0.5794684678643381f,\n            -0.7504883828755602f,   -0.4004672082940195f,    0.15296486218853164f,   0.5029860367700724f,\n            -0.7504883828755602f,    0.15296486218853164f,  -0.4004672082940195f,    0.5029860367700724f,\n            -0.8828161875373585f,    0.08164729285680945f,   0.08164729285680945f,   0.4553054119602712f,\n            -0.4553054119602712f,   -0.08164729285680945f,  -0.08164729285680945f,   0.8828161875373585f,\n            -0.5029860367700724f,   -0.15296486218853164f,   0.4004672082940195f,    0.7504883828755602f,\n            -0.5029860367700724f,    0.4004672082940195f,   -0.15296486218853164f,   0.7504883828755602f,\n            -0.5794684678643381f,    0.3239847771997537f,    0.3239847771997537f,    0.6740059517812944f,\n            -0.6740059517812944f,   -0.3239847771997537f,    0.5794684678643381f,   -0.3239847771997537f,\n            -0.7504883828755602f,   -0.4004672082940195f,    0.5029860367700724f,    0.15296486218853164f,\n            -0.7504883828755602f,    0.15296486218853164f,   0.5029860367700724f,   -0.4004672082940195f,\n            -0.8828161875373585f,    0.08164729285680945f,   0.4553054119602712f,    0.08164729285680945f,\n            -0.4553054119602712f,   -0.08164729285680945f,   0.8828161875373585f,   -0.08164729285680945f,\n            -0.5029860367700724f,   -0.15296486218853164f,   0.7504883828755602f,    0.4004672082940195f,\n            -0.5029860367700724f,    0.4004672082940195f,    0.7504883828755602f,   -0.15296486218853164f,\n            -0.5794684678643381f,    0.3239847771997537f,    0.6740059517812944f,    0.3239847771997537f,\n            -0.6740059517812944f,    0.5794684678643381f,   -0.3239847771997537f,   -0.3239847771997537f,\n            -0.7504883828755602f,    0.5029860367700724f,   -0.4004672082940195f,    0.15296486218853164f,\n            -0.7504883828755602f,    0.5029860367700724f,    0.15296486218853164f,  -0.4004672082940195f,\n            -0.8828161875373585f,    0.4553054119602712f,    0.08164729285680945f,   0.08164729285680945f,\n            -0.4553054119602712f,    0.8828161875373585f,   -0.08164729285680945f,  -0.08164729285680945f,\n            -0.5029860367700724f,    0.7504883828755602f,   -0.15296486218853164f,   0.4004672082940195f,\n            -0.5029860367700724f,    0.7504883828755602f,    0.4004672082940195f,   -0.15296486218853164f,\n            -0.5794684678643381f,    0.6740059517812944f,    0.3239847771997537f,    0.3239847771997537f,\n             0.5794684678643381f,   -0.6740059517812944f,   -0.3239847771997537f,   -0.3239847771997537f,\n             0.5029860367700724f,   -0.7504883828755602f,   -0.4004672082940195f,    0.15296486218853164f,\n             0.5029860367700724f,   -0.7504883828755602f,    0.15296486218853164f,  -0.4004672082940195f,\n             0.4553054119602712f,   -0.8828161875373585f,    0.08164729285680945f,   0.08164729285680945f,\n             0.8828161875373585f,   -0.4553054119602712f,   -0.08164729285680945f,  -0.08164729285680945f,\n             0.7504883828755602f,   -0.5029860367700724f,   -0.15296486218853164f,   0.4004672082940195f,\n             0.7504883828755602f,   -0.5029860367700724f,    0.4004672082940195f,   -0.15296486218853164f,\n             0.6740059517812944f,   -0.5794684678643381f,    0.3239847771997537f,    0.3239847771997537f,\n            //------------------------------------------------------------------------------------------//\n            -0.753341017856078f,    -0.37968289875261624f,  -0.37968289875261624f,  -0.37968289875261624f,\n            -0.7821684431180708f,   -0.4321472685365301f,   -0.4321472685365301f,    0.12128480194602098f,\n            -0.7821684431180708f,   -0.4321472685365301f,    0.12128480194602098f,  -0.4321472685365301f,\n            -0.7821684431180708f,    0.12128480194602098f,  -0.4321472685365301f,   -0.4321472685365301f,\n            -0.8586508742123365f,   -0.508629699630796f,     0.044802370851755174f,  0.044802370851755174f,\n            -0.8586508742123365f,    0.044802370851755174f, -0.508629699630796f,     0.044802370851755174f,\n            -0.8586508742123365f,    0.044802370851755174f,  0.044802370851755174f, -0.508629699630796f,\n            -0.9982828964265062f,   -0.03381941603233842f,  -0.03381941603233842f,  -0.03381941603233842f,\n            -0.37968289875261624f,  -0.753341017856078f,    -0.37968289875261624f,  -0.37968289875261624f,\n            -0.4321472685365301f,   -0.7821684431180708f,   -0.4321472685365301f,    0.12128480194602098f,\n            -0.4321472685365301f,   -0.7821684431180708f,    0.12128480194602098f,  -0.4321472685365301f,\n             0.12128480194602098f,  -0.7821684431180708f,   -0.4321472685365301f,   -0.4321472685365301f,\n            -0.508629699630796f,    -0.8586508742123365f,    0.044802370851755174f,  0.044802370851755174f,\n             0.044802370851755174f, -0.8586508742123365f,   -0.508629699630796f,     0.044802370851755174f,\n             0.044802370851755174f, -0.8586508742123365f,    0.044802370851755174f, -0.508629699630796f,\n            -0.03381941603233842f,  -0.9982828964265062f,   -0.03381941603233842f,  -0.03381941603233842f,\n            -0.37968289875261624f,  -0.37968289875261624f,  -0.753341017856078f,    -0.37968289875261624f,\n            -0.4321472685365301f,   -0.4321472685365301f,   -0.7821684431180708f,    0.12128480194602098f,\n            -0.4321472685365301f,    0.12128480194602098f,  -0.7821684431180708f,   -0.4321472685365301f,\n             0.12128480194602098f,  -0.4321472685365301f,   -0.7821684431180708f,   -0.4321472685365301f,\n            -0.508629699630796f,     0.044802370851755174f, -0.8586508742123365f,    0.044802370851755174f,\n             0.044802370851755174f, -0.508629699630796f,    -0.8586508742123365f,    0.044802370851755174f,\n             0.044802370851755174f,  0.044802370851755174f, -0.8586508742123365f,   -0.508629699630796f,\n            -0.03381941603233842f,  -0.03381941603233842f,  -0.9982828964265062f,   -0.03381941603233842f,\n            -0.37968289875261624f,  -0.37968289875261624f,  -0.37968289875261624f,  -0.753341017856078f,\n            -0.4321472685365301f,   -0.4321472685365301f,    0.12128480194602098f,  -0.7821684431180708f,\n            -0.4321472685365301f,    0.12128480194602098f,  -0.4321472685365301f,   -0.7821684431180708f,\n             0.12128480194602098f,  -0.4321472685365301f,   -0.4321472685365301f,   -0.7821684431180708f,\n            -0.508629699630796f,     0.044802370851755174f,  0.044802370851755174f, -0.8586508742123365f,\n             0.044802370851755174f, -0.508629699630796f,     0.044802370851755174f, -0.8586508742123365f,\n             0.044802370851755174f,  0.044802370851755174f, -0.508629699630796f,    -0.8586508742123365f,\n            -0.03381941603233842f,  -0.03381941603233842f,  -0.03381941603233842f,  -0.9982828964265062f,\n            -0.3239847771997537f,   -0.6740059517812944f,   -0.3239847771997537f,    0.5794684678643381f,\n            -0.4004672082940195f,   -0.7504883828755602f,    0.15296486218853164f,   0.5029860367700724f,\n             0.15296486218853164f,  -0.7504883828755602f,   -0.4004672082940195f,    0.5029860367700724f,\n             0.08164729285680945f,  -0.8828161875373585f,    0.08164729285680945f,   0.4553054119602712f,\n            -0.08164729285680945f,  -0.4553054119602712f,   -0.08164729285680945f,   0.8828161875373585f,\n            -0.15296486218853164f,  -0.5029860367700724f,    0.4004672082940195f,    0.7504883828755602f,\n             0.4004672082940195f,   -0.5029860367700724f,   -0.15296486218853164f,   0.7504883828755602f,\n             0.3239847771997537f,   -0.5794684678643381f,    0.3239847771997537f,    0.6740059517812944f,\n            -0.3239847771997537f,   -0.3239847771997537f,   -0.6740059517812944f,    0.5794684678643381f,\n            -0.4004672082940195f,    0.15296486218853164f,  -0.7504883828755602f,    0.5029860367700724f,\n             0.15296486218853164f,  -0.4004672082940195f,   -0.7504883828755602f,    0.5029860367700724f,\n             0.08164729285680945f,   0.08164729285680945f,  -0.8828161875373585f,    0.4553054119602712f,\n            -0.08164729285680945f,  -0.08164729285680945f,  -0.4553054119602712f,    0.8828161875373585f,\n            -0.15296486218853164f,   0.4004672082940195f,   -0.5029860367700724f,    0.7504883828755602f,\n             0.4004672082940195f,   -0.15296486218853164f,  -0.5029860367700724f,    0.7504883828755602f,\n             0.3239847771997537f,    0.3239847771997537f,   -0.5794684678643381f,    0.6740059517812944f,\n            -0.3239847771997537f,   -0.6740059517812944f,    0.5794684678643381f,   -0.3239847771997537f,\n            -0.4004672082940195f,   -0.7504883828755602f,    0.5029860367700724f,    0.15296486218853164f,\n             0.15296486218853164f,  -0.7504883828755602f,    0.5029860367700724f,   -0.4004672082940195f,\n             0.08164729285680945f,  -0.8828161875373585f,    0.4553054119602712f,    0.08164729285680945f,\n            -0.08164729285680945f,  -0.4553054119602712f,    0.8828161875373585f,   -0.08164729285680945f,\n            -0.15296486218853164f,  -0.5029860367700724f,    0.7504883828755602f,    0.4004672082940195f,\n             0.4004672082940195f,   -0.5029860367700724f,    0.7504883828755602f,   -0.15296486218853164f,\n             0.3239847771997537f,   -0.5794684678643381f,    0.6740059517812944f,    0.3239847771997537f,\n            -0.3239847771997537f,   -0.3239847771997537f,    0.5794684678643381f,   -0.6740059517812944f,\n            -0.4004672082940195f,    0.15296486218853164f,   0.5029860367700724f,   -0.7504883828755602f,\n             0.15296486218853164f,  -0.4004672082940195f,    0.5029860367700724f,   -0.7504883828755602f,\n             0.08164729285680945f,   0.08164729285680945f,   0.4553054119602712f,   -0.8828161875373585f,\n            -0.08164729285680945f,  -0.08164729285680945f,   0.8828161875373585f,   -0.4553054119602712f,\n            -0.15296486218853164f,   0.4004672082940195f,    0.7504883828755602f,   -0.5029860367700724f,\n             0.4004672082940195f,   -0.15296486218853164f,   0.7504883828755602f,   -0.5029860367700724f,\n             0.3239847771997537f,    0.3239847771997537f,    0.6740059517812944f,   -0.5794684678643381f,\n            -0.3239847771997537f,    0.5794684678643381f,   -0.6740059517812944f,   -0.3239847771997537f,\n            -0.4004672082940195f,    0.5029860367700724f,   -0.7504883828755602f,    0.15296486218853164f,\n             0.15296486218853164f,   0.5029860367700724f,   -0.7504883828755602f,   -0.4004672082940195f,\n             0.08164729285680945f,   0.4553054119602712f,   -0.8828161875373585f,    0.08164729285680945f,\n            -0.08164729285680945f,   0.8828161875373585f,   -0.4553054119602712f,   -0.08164729285680945f,\n            -0.15296486218853164f,   0.7504883828755602f,   -0.5029860367700724f,    0.4004672082940195f,\n             0.4004672082940195f,    0.7504883828755602f,   -0.5029860367700724f,   -0.15296486218853164f,\n             0.3239847771997537f,    0.6740059517812944f,   -0.5794684678643381f,    0.3239847771997537f,\n            -0.3239847771997537f,    0.5794684678643381f,   -0.3239847771997537f,   -0.6740059517812944f,\n            -0.4004672082940195f,    0.5029860367700724f,    0.15296486218853164f,  -0.7504883828755602f,\n             0.15296486218853164f,   0.5029860367700724f,   -0.4004672082940195f,   -0.7504883828755602f,\n             0.08164729285680945f,   0.4553054119602712f,    0.08164729285680945f,  -0.8828161875373585f,\n            -0.08164729285680945f,   0.8828161875373585f,   -0.08164729285680945f,  -0.4553054119602712f,\n            -0.15296486218853164f,   0.7504883828755602f,    0.4004672082940195f,   -0.5029860367700724f,\n             0.4004672082940195f,    0.7504883828755602f,   -0.15296486218853164f,  -0.5029860367700724f,\n             0.3239847771997537f,    0.6740059517812944f,    0.3239847771997537f,   -0.5794684678643381f,\n             0.5794684678643381f,   -0.3239847771997537f,   -0.6740059517812944f,   -0.3239847771997537f,\n             0.5029860367700724f,   -0.4004672082940195f,   -0.7504883828755602f,    0.15296486218853164f,\n             0.5029860367700724f,    0.15296486218853164f,  -0.7504883828755602f,   -0.4004672082940195f,\n             0.4553054119602712f,    0.08164729285680945f,  -0.8828161875373585f,    0.08164729285680945f,\n             0.8828161875373585f,   -0.08164729285680945f,  -0.4553054119602712f,   -0.08164729285680945f,\n             0.7504883828755602f,   -0.15296486218853164f,  -0.5029860367700724f,    0.4004672082940195f,\n             0.7504883828755602f,    0.4004672082940195f,   -0.5029860367700724f,   -0.15296486218853164f,\n             0.6740059517812944f,    0.3239847771997537f,   -0.5794684678643381f,    0.3239847771997537f,\n             0.5794684678643381f,   -0.3239847771997537f,   -0.3239847771997537f,   -0.6740059517812944f,\n             0.5029860367700724f,   -0.4004672082940195f,    0.15296486218853164f,  -0.7504883828755602f,\n             0.5029860367700724f,    0.15296486218853164f,  -0.4004672082940195f,   -0.7504883828755602f,\n             0.4553054119602712f,    0.08164729285680945f,   0.08164729285680945f,  -0.8828161875373585f,\n             0.8828161875373585f,   -0.08164729285680945f,  -0.08164729285680945f,  -0.4553054119602712f,\n             0.7504883828755602f,   -0.15296486218853164f,   0.4004672082940195f,   -0.5029860367700724f,\n             0.7504883828755602f,    0.4004672082940195f,   -0.15296486218853164f,  -0.5029860367700724f,\n             0.6740059517812944f,    0.3239847771997537f,    0.3239847771997537f,   -0.5794684678643381f,\n             0.03381941603233842f,   0.03381941603233842f,   0.03381941603233842f,   0.9982828964265062f,\n            -0.044802370851755174f, -0.044802370851755174f,  0.508629699630796f,     0.8586508742123365f,\n            -0.044802370851755174f,  0.508629699630796f,    -0.044802370851755174f,  0.8586508742123365f,\n            -0.12128480194602098f,   0.4321472685365301f,    0.4321472685365301f,    0.7821684431180708f,\n             0.508629699630796f,    -0.044802370851755174f, -0.044802370851755174f,  0.8586508742123365f,\n             0.4321472685365301f,   -0.12128480194602098f,   0.4321472685365301f,    0.7821684431180708f,\n             0.4321472685365301f,    0.4321472685365301f,   -0.12128480194602098f,   0.7821684431180708f,\n             0.37968289875261624f,   0.37968289875261624f,   0.37968289875261624f,   0.753341017856078f,\n             0.03381941603233842f,   0.03381941603233842f,   0.9982828964265062f,    0.03381941603233842f,\n            -0.044802370851755174f,  0.044802370851755174f,  0.8586508742123365f,    0.508629699630796f,\n            -0.044802370851755174f,  0.508629699630796f,     0.8586508742123365f,   -0.044802370851755174f,\n            -0.12128480194602098f,   0.4321472685365301f,    0.7821684431180708f,    0.4321472685365301f,\n             0.508629699630796f,    -0.044802370851755174f,  0.8586508742123365f,   -0.044802370851755174f,\n             0.4321472685365301f,   -0.12128480194602098f,   0.7821684431180708f,    0.4321472685365301f,\n             0.4321472685365301f,    0.4321472685365301f,    0.7821684431180708f,   -0.12128480194602098f,\n             0.37968289875261624f,   0.37968289875261624f,   0.753341017856078f,     0.37968289875261624f,\n             0.03381941603233842f,   0.9982828964265062f,    0.03381941603233842f,   0.03381941603233842f,\n            -0.044802370851755174f,  0.8586508742123365f,   -0.044802370851755174f,  0.508629699630796f,\n            -0.044802370851755174f,  0.8586508742123365f,    0.508629699630796f,    -0.044802370851755174f,\n            -0.12128480194602098f,   0.7821684431180708f,    0.4321472685365301f,    0.4321472685365301f,\n             0.508629699630796f,     0.8586508742123365f,   -0.044802370851755174f, -0.044802370851755174f,\n             0.4321472685365301f,    0.7821684431180708f,   -0.12128480194602098f,   0.4321472685365301f,\n             0.4321472685365301f,    0.7821684431180708f,    0.4321472685365301f,   -0.12128480194602098f,\n             0.37968289875261624f,   0.753341017856078f,     0.37968289875261624f,   0.37968289875261624f,\n             0.9982828964265062f,    0.03381941603233842f,   0.03381941603233842f,   0.03381941603233842f,\n             0.8586508742123365f,   -0.044802370851755174f, -0.044802370851755174f,  0.508629699630796f,\n             0.8586508742123365f,   -0.044802370851755174f,  0.508629699630796f,    -0.044802370851755174f,\n             0.7821684431180708f,   -0.12128480194602098f,   0.4321472685365301f,    0.4321472685365301f,\n             0.8586508742123365f,    0.508629699630796f,    -0.044802370851755174f, -0.044802370851755174f,\n             0.7821684431180708f,    0.4321472685365301f,   -0.12128480194602098f,   0.4321472685365301f,\n             0.7821684431180708f,    0.4321472685365301f,    0.4321472685365301f,   -0.12128480194602098f,\n             0.753341017856078f,     0.37968289875261624f,   0.37968289875261624f,   0.37968289875261624f,\n        };\n        for (int i = 0; i < grad4.length; i++) {\n            grad4[i] = (float)(grad4[i] / NORMALIZER_4D);\n        }\n        for (int i = 0, j = 0; i < GRADIENTS_4D.length; i++, j++) {\n            if (j == grad4.length) j = 0;\n            GRADIENTS_4D[i] = grad4[j];\n        }\n    }\n}\n"
  },
  {
    "path": "java/OpenSimplex2S.java",
    "content": "/**\n * K.jpg's OpenSimplex 2, smooth variant (\"SuperSimplex\")\n */\n\npublic class OpenSimplex2S {\n\n    private static final long PRIME_X = 0x5205402B9270C86FL;\n    private static final long PRIME_Y = 0x598CD327003817B5L;\n    private static final long PRIME_Z = 0x5BCC226E9FA0BACBL;\n    private static final long PRIME_W = 0x56CC5227E58F554BL;\n    private static final long HASH_MULTIPLIER = 0x53A3F72DEEC546F5L;\n    private static final long SEED_FLIP_3D = -0x52D547B2E96ED629L;\n\n    private static final double ROOT2OVER2 = 0.7071067811865476;\n    private static final double SKEW_2D = 0.366025403784439;\n    private static final double UNSKEW_2D = -0.21132486540518713;\n\n    private static final double ROOT3OVER3 = 0.577350269189626;\n    private static final double FALLBACK_ROTATE3 = 2.0 / 3.0;\n    private static final double ROTATE3_ORTHOGONALIZER = UNSKEW_2D;\n\n    private static final float SKEW_4D = 0.309016994374947f;\n    private static final float UNSKEW_4D = -0.138196601125011f;\n\n    private static final int N_GRADS_2D_EXPONENT = 7;\n    private static final int N_GRADS_3D_EXPONENT = 8;\n    private static final int N_GRADS_4D_EXPONENT = 9;\n    private static final int N_GRADS_2D = 1 << N_GRADS_2D_EXPONENT;\n    private static final int N_GRADS_3D = 1 << N_GRADS_3D_EXPONENT;\n    private static final int N_GRADS_4D = 1 << N_GRADS_4D_EXPONENT;\n\n    private static final double NORMALIZER_2D = 0.05481866495625118;\n    private static final double NORMALIZER_3D = 0.2781926117527186;\n    private static final double NORMALIZER_4D = 0.11127401889945551;\n\n    private static final float RSQUARED_2D = 2.0f / 3.0f;\n    private static final float RSQUARED_3D = 3.0f / 4.0f;\n    private static final float RSQUARED_4D = 4.0f / 5.0f;\n\n    /*\n     * Noise Evaluators\n     */\n\n    /**\n     * 2D OpenSimplex2S/SuperSimplex noise, standard lattice orientation.\n     */\n    public static float noise2(long seed, double x, double y) {\n\n        // Get points for A2* lattice\n        double s = SKEW_2D * (x + y);\n        double xs = x + s, ys = y + s;\n\n        return noise2_UnskewedBase(seed, xs, ys);\n    }\n\n    /**\n     * 2D OpenSimplex2S/SuperSimplex noise, with Y pointing down the main diagonal.\n     * Might be better for a 2D sandbox style game, where Y is vertical.\n     * Probably slightly less optimal for heightmaps or continent maps,\n     * unless your map is centered around an equator. It's a slight\n     * difference, but the option is here to make it easy.\n     */\n    public static float noise2_ImproveX(long seed, double x, double y) {\n\n        // Skew transform and rotation baked into one.\n        double xx = x * ROOT2OVER2;\n        double yy = y * (ROOT2OVER2 * (1 + 2 * SKEW_2D));\n\n        return noise2_UnskewedBase(seed, yy + xx, yy - xx);\n    }\n\n    /**\n     * 2D  OpenSimplex2S/SuperSimplex noise base.\n     */\n    private static float noise2_UnskewedBase(long seed, double xs, double ys) {\n\n        // Get base points and offsets.\n        int xsb = fastFloor(xs), ysb = fastFloor(ys);\n        float xi = (float)(xs - xsb), yi = (float)(ys - ysb);\n\n        // Prime pre-multiplication for hash.\n        long xsbp = xsb * PRIME_X, ysbp = ysb * PRIME_Y;\n\n        // Unskew.\n        float t = (xi + yi) * (float)UNSKEW_2D;\n        float dx0 = xi + t, dy0 = yi + t;\n\n        // First vertex.\n        float a0 = RSQUARED_2D - dx0 * dx0 - dy0 * dy0;\n        float value = (a0 * a0) * (a0 * a0) * grad(seed, xsbp, ysbp, dx0, dy0);\n\n        // Second vertex.\n        float a1 = (float)(2 * (1 + 2 * UNSKEW_2D) * (1 / UNSKEW_2D + 2)) * t + ((float)(-2 * (1 + 2 * UNSKEW_2D) * (1 + 2 * UNSKEW_2D)) + a0);\n        float dx1 = dx0 - (float)(1 + 2 * UNSKEW_2D);\n        float dy1 = dy0 - (float)(1 + 2 * UNSKEW_2D);\n        value += (a1 * a1) * (a1 * a1) * grad(seed, xsbp + PRIME_X, ysbp + PRIME_Y, dx1, dy1);\n\n        // Third and fourth vertices.\n        // Nested conditionals were faster than compact bit logic/arithmetic.\n        float xmyi = xi - yi;\n        if (t < UNSKEW_2D) {\n            if (xi + xmyi > 1) {\n                float dx2 = dx0 - (float)(3 * UNSKEW_2D + 2);\n                float dy2 = dy0 - (float)(3 * UNSKEW_2D + 1);\n                float a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n                if (a2 > 0) {\n                    value += (a2 * a2) * (a2 * a2) * grad(seed, xsbp + (PRIME_X << 1), ysbp + PRIME_Y, dx2, dy2);\n                }\n            }\n            else\n            {\n                float dx2 = dx0 - (float)UNSKEW_2D;\n                float dy2 = dy0 - (float)(UNSKEW_2D + 1);\n                float a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n                if (a2 > 0) {\n                    value += (a2 * a2) * (a2 * a2) * grad(seed, xsbp, ysbp + PRIME_Y, dx2, dy2);\n                }\n            }\n\n            if (yi - xmyi > 1) {\n                float dx3 = dx0 - (float)(3 * UNSKEW_2D + 1);\n                float dy3 = dy0 - (float)(3 * UNSKEW_2D + 2);\n                float a3 = RSQUARED_2D - dx3 * dx3 - dy3 * dy3;\n                if (a3 > 0) {\n                    value += (a3 * a3) * (a3 * a3) * grad(seed, xsbp + PRIME_X, ysbp + (PRIME_Y << 1), dx3, dy3);\n                }\n            }\n            else\n            {\n                float dx3 = dx0 - (float)(UNSKEW_2D + 1);\n                float dy3 = dy0 - (float)UNSKEW_2D;\n                float a3 = RSQUARED_2D - dx3 * dx3 - dy3 * dy3;\n                if (a3 > 0) {\n                    value += (a3 * a3) * (a3 * a3) * grad(seed, xsbp + PRIME_X, ysbp, dx3, dy3);\n                }\n            }\n        }\n        else\n        {\n            if (xi + xmyi < 0) {\n                float dx2 = dx0 + (float)(1 + UNSKEW_2D);\n                float dy2 = dy0 + (float)UNSKEW_2D;\n                float a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n                if (a2 > 0) {\n                    value += (a2 * a2) * (a2 * a2) * grad(seed, xsbp - PRIME_X, ysbp, dx2, dy2);\n                }\n            }\n            else\n            {\n                float dx2 = dx0 - (float)(UNSKEW_2D + 1);\n                float dy2 = dy0 - (float)UNSKEW_2D;\n                float a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n                if (a2 > 0) {\n                    value += (a2 * a2) * (a2 * a2) * grad(seed, xsbp + PRIME_X, ysbp, dx2, dy2);\n                }\n            }\n\n            if (yi < xmyi) {\n                float dx2 = dx0 + (float)UNSKEW_2D;\n                float dy2 = dy0 + (float)(UNSKEW_2D + 1);\n                float a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n                if (a2 > 0) {\n                    value += (a2 * a2) * (a2 * a2) * grad(seed, xsbp, ysbp - PRIME_Y, dx2, dy2);\n                }\n            }\n            else\n            {\n                float dx2 = dx0 - (float)UNSKEW_2D;\n                float dy2 = dy0 - (float)(UNSKEW_2D + 1);\n                float a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n                if (a2 > 0) {\n                    value += (a2 * a2) * (a2 * a2) * grad(seed, xsbp, ysbp + PRIME_Y, dx2, dy2);\n                }\n            }\n        }\n\n        return value;\n    }\n\n    /**\n     * 3D OpenSimplex2S/SuperSimplex noise, with better visual isotropy in (X, Y).\n     * Recommended for 3D terrain and time-varied animations.\n     * The Z coordinate should always be the \"different\" coordinate in whatever your use case is.\n     * If Y is vertical in world coordinates, call noise3_ImproveXZ(x, z, Y) or use noise3_XZBeforeY.\n     * If Z is vertical in world coordinates, call noise3_ImproveXZ(x, y, Z).\n     * For a time varied animation, call noise3_ImproveXY(x, y, T).\n     */\n    public static float noise3_ImproveXY(long seed, double x, double y, double z) {\n\n        // Re-orient the cubic lattices without skewing, so Z points up the main lattice diagonal,\n        // and the planes formed by XY are moved far out of alignment with the cube faces.\n        // Orthonormal rotation. Not a skew transform.\n        double xy = x + y;\n        double s2 = xy * ROTATE3_ORTHOGONALIZER;\n        double zz = z * ROOT3OVER3;\n        double xr = x + s2 + zz;\n        double yr = y + s2 + zz;\n        double zr = xy * -ROOT3OVER3 + zz;\n\n        // Evaluate both lattices to form a BCC lattice.\n        return noise3_UnrotatedBase(seed, xr, yr, zr);\n    }\n\n    /**\n     * 3D OpenSimplex2S/SuperSimplex noise, with better visual isotropy in (X, Z).\n     * Recommended for 3D terrain and time-varied animations.\n     * The Y coordinate should always be the \"different\" coordinate in whatever your use case is.\n     * If Y is vertical in world coordinates, call noise3_ImproveXZ(x, Y, z).\n     * If Z is vertical in world coordinates, call noise3_ImproveXZ(x, Z, y) or use noise3_ImproveXY.\n     * For a time varied animation, call noise3_ImproveXZ(x, T, y) or use noise3_ImproveXY.\n     */\n    public static float noise3_ImproveXZ(long seed, double x, double y, double z) {\n\n        // Re-orient the cubic lattices without skewing, so Y points up the main lattice diagonal,\n        // and the planes formed by XZ are moved far out of alignment with the cube faces.\n        // Orthonormal rotation. Not a skew transform.\n        double xz = x + z;\n        double s2 = xz * -0.211324865405187;\n        double yy = y * ROOT3OVER3;\n        double xr = x + s2 + yy;\n        double zr = z + s2 + yy;\n        double yr = xz * -ROOT3OVER3 + yy;\n\n        // Evaluate both lattices to form a BCC lattice.\n        return noise3_UnrotatedBase(seed, xr, yr, zr);\n    }\n\n    /**\n     * 3D OpenSimplex2S/SuperSimplex noise, fallback rotation option\n     * Use noise3_ImproveXY or noise3_ImproveXZ instead, wherever appropriate.\n     * They have less diagonal bias. This function's best use is as a fallback.\n     */\n    public static float noise3_Fallback(long seed, double x, double y, double z) {\n\n        // Re-orient the cubic lattices via rotation, to produce a familiar look.\n        // Orthonormal rotation. Not a skew transform.\n        double r = FALLBACK_ROTATE3 * (x + y + z);\n        double xr = r - x, yr = r - y, zr = r - z;\n\n        // Evaluate both lattices to form a BCC lattice.\n        return noise3_UnrotatedBase(seed, xr, yr, zr);\n    }\n\n    /**\n     * Generate overlapping cubic lattices for 3D Re-oriented BCC noise.\n     * Lookup table implementation inspired by DigitalShadow.\n     * It was actually faster to narrow down the points in the loop itself,\n     * than to build up the index with enough info to isolate 8 points.\n     */\n    private static float noise3_UnrotatedBase(long seed, double xr, double yr, double zr) {\n\n        // Get base points and offsets.\n        int xrb = fastFloor(xr), yrb = fastFloor(yr), zrb = fastFloor(zr);\n        float xi = (float)(xr - xrb), yi = (float)(yr - yrb), zi = (float)(zr - zrb);\n\n        // Prime pre-multiplication for hash. Also flip seed for second lattice copy.\n        long xrbp = xrb * PRIME_X, yrbp = yrb * PRIME_Y, zrbp = zrb * PRIME_Z;\n        long seed2 = seed ^ -0x52D547B2E96ED629L;\n\n        // -1 if positive, 0 if negative.\n        int xNMask = (int)(-0.5f - xi), yNMask = (int)(-0.5f - yi), zNMask = (int)(-0.5f - zi);\n\n        // First vertex.\n        float x0 = xi + xNMask;\n        float y0 = yi + yNMask;\n        float z0 = zi + zNMask;\n        float a0 = RSQUARED_3D - x0 * x0 - y0 * y0 - z0 * z0;\n        float value = (a0 * a0) * (a0 * a0) * grad(seed,\n                xrbp + (xNMask & PRIME_X), yrbp + (yNMask & PRIME_Y), zrbp + (zNMask & PRIME_Z), x0, y0, z0);\n\n        // Second vertex.\n        float x1 = xi - 0.5f;\n        float y1 = yi - 0.5f;\n        float z1 = zi - 0.5f;\n        float a1 = RSQUARED_3D - x1 * x1 - y1 * y1 - z1 * z1;\n        value += (a1 * a1) * (a1 * a1) * grad(seed2,\n                xrbp + PRIME_X, yrbp + PRIME_Y, zrbp + PRIME_Z, x1, y1, z1);\n\n        // Shortcuts for building the remaining falloffs.\n        // Derived by subtracting the polynomials with the offsets plugged in.\n        float xAFlipMask0 = ((xNMask | 1) << 1) * x1;\n        float yAFlipMask0 = ((yNMask | 1) << 1) * y1;\n        float zAFlipMask0 = ((zNMask | 1) << 1) * z1;\n        float xAFlipMask1 = (-2 - (xNMask << 2)) * x1 - 1.0f;\n        float yAFlipMask1 = (-2 - (yNMask << 2)) * y1 - 1.0f;\n        float zAFlipMask1 = (-2 - (zNMask << 2)) * z1 - 1.0f;\n\n        boolean skip5 = false;\n        float a2 = xAFlipMask0 + a0;\n        if (a2 > 0) {\n            float x2 = x0 - (xNMask | 1);\n            float y2 = y0;\n            float z2 = z0;\n            value += (a2 * a2) * (a2 * a2) * grad(seed,\n                    xrbp + (~xNMask & PRIME_X), yrbp + (yNMask & PRIME_Y), zrbp + (zNMask & PRIME_Z), x2, y2, z2);\n        }\n        else\n        {\n            float a3 = yAFlipMask0 + zAFlipMask0 + a0;\n            if (a3 > 0) {\n                float x3 = x0;\n                float y3 = y0 - (yNMask | 1);\n                float z3 = z0 - (zNMask | 1);\n                value += (a3 * a3) * (a3 * a3) * grad(seed,\n                        xrbp + (xNMask & PRIME_X), yrbp + (~yNMask & PRIME_Y), zrbp + (~zNMask & PRIME_Z), x3, y3, z3);\n            }\n\n            float a4 = xAFlipMask1 + a1;\n            if (a4 > 0) {\n                float x4 = (xNMask | 1) + x1;\n                float y4 = y1;\n                float z4 = z1;\n                value += (a4 * a4) * (a4 * a4) * grad(seed2,\n                        xrbp + (xNMask & (PRIME_X * 2)), yrbp + PRIME_Y, zrbp + PRIME_Z, x4, y4, z4);\n                skip5 = true;\n            }\n        }\n\n        boolean skip9 = false;\n        float a6 = yAFlipMask0 + a0;\n        if (a6 > 0) {\n            float x6 = x0;\n            float y6 = y0 - (yNMask | 1);\n            float z6 = z0;\n            value += (a6 * a6) * (a6 * a6) * grad(seed,\n                    xrbp + (xNMask & PRIME_X), yrbp + (~yNMask & PRIME_Y), zrbp + (zNMask & PRIME_Z), x6, y6, z6);\n        }\n        else\n        {\n            float a7 = xAFlipMask0 + zAFlipMask0 + a0;\n            if (a7 > 0) {\n                float x7 = x0 - (xNMask | 1);\n                float y7 = y0;\n                float z7 = z0 - (zNMask | 1);\n                value += (a7 * a7) * (a7 * a7) * grad(seed,\n                        xrbp + (~xNMask & PRIME_X), yrbp + (yNMask & PRIME_Y), zrbp + (~zNMask & PRIME_Z), x7, y7, z7);\n            }\n\n            float a8 = yAFlipMask1 + a1;\n            if (a8 > 0) {\n                float x8 = x1;\n                float y8 = (yNMask | 1) + y1;\n                float z8 = z1;\n                value += (a8 * a8) * (a8 * a8) * grad(seed2,\n                        xrbp + PRIME_X, yrbp + (yNMask & (PRIME_Y << 1)), zrbp + PRIME_Z, x8, y8, z8);\n                skip9 = true;\n            }\n        }\n\n        boolean skipD = false;\n        float aA = zAFlipMask0 + a0;\n        if (aA > 0) {\n            float xA = x0;\n            float yA = y0;\n            float zA = z0 - (zNMask | 1);\n            value += (aA * aA) * (aA * aA) * grad(seed,\n                    xrbp + (xNMask & PRIME_X), yrbp + (yNMask & PRIME_Y), zrbp + (~zNMask & PRIME_Z), xA, yA, zA);\n        }\n        else\n        {\n            float aB = xAFlipMask0 + yAFlipMask0 + a0;\n            if (aB > 0) {\n                float xB = x0 - (xNMask | 1);\n                float yB = y0 - (yNMask | 1);\n                float zB = z0;\n                value += (aB * aB) * (aB * aB) * grad(seed,\n                        xrbp + (~xNMask & PRIME_X), yrbp + (~yNMask & PRIME_Y), zrbp + (zNMask & PRIME_Z), xB, yB, zB);\n            }\n\n            float aC = zAFlipMask1 + a1;\n            if (aC > 0) {\n                float xC = x1;\n                float yC = y1;\n                float zC = (zNMask | 1) + z1;\n                value += (aC * aC) * (aC * aC) * grad(seed2,\n                        xrbp + PRIME_X, yrbp + PRIME_Y, zrbp + (zNMask & (PRIME_Z << 1)), xC, yC, zC);\n                skipD = true;\n            }\n        }\n\n        if (!skip5) {\n            float a5 = yAFlipMask1 + zAFlipMask1 + a1;\n            if (a5 > 0) {\n                float x5 = x1;\n                float y5 = (yNMask | 1) + y1;\n                float z5 = (zNMask | 1) + z1;\n                value += (a5 * a5) * (a5 * a5) * grad(seed2,\n                        xrbp + PRIME_X, yrbp + (yNMask & (PRIME_Y << 1)), zrbp + (zNMask & (PRIME_Z << 1)), x5, y5, z5);\n            }\n        }\n\n        if (!skip9) {\n            float a9 = xAFlipMask1 + zAFlipMask1 + a1;\n            if (a9 > 0) {\n                float x9 = (xNMask | 1) + x1;\n                float y9 = y1;\n                float z9 = (zNMask | 1) + z1;\n                value += (a9 * a9) * (a9 * a9) * grad(seed2,\n                        xrbp + (xNMask & (PRIME_X * 2)), yrbp + PRIME_Y, zrbp + (zNMask & (PRIME_Z << 1)), x9, y9, z9);\n            }\n        }\n\n        if (!skipD) {\n            float aD = xAFlipMask1 + yAFlipMask1 + a1;\n            if (aD > 0) {\n                float xD = (xNMask | 1) + x1;\n                float yD = (yNMask | 1) + y1;\n                float zD = z1;\n                value += (aD * aD) * (aD * aD) * grad(seed2,\n                        xrbp + (xNMask & (PRIME_X << 1)), yrbp + (yNMask & (PRIME_Y << 1)), zrbp + PRIME_Z, xD, yD, zD);\n            }\n        }\n\n        return value;\n    }\n\n    /**\n     * 4D SuperSimplex noise, with XYZ oriented like noise3_ImproveXY\n     * and W for an extra degree of freedom. W repeats eventually.\n     * Recommended for time-varied animations which texture a 3D object (W=time)\n     * in a space where Z is vertical\n     */\n    public static float noise4_ImproveXYZ_ImproveXY(long seed, double x, double y, double z, double w) {\n        double xy = x + y;\n        double s2 = xy * -0.21132486540518699998;\n        double zz = z * 0.28867513459481294226;\n        double ww = w * 1.118033988749894;\n        double xr = x + (zz + ww + s2), yr = y + (zz + ww + s2);\n        double zr = xy * -0.57735026918962599998 + (zz + ww);\n        double wr = z * -0.866025403784439 + ww;\n\n        return noise4_UnskewedBase(seed, xr, yr, zr, wr);\n    }\n\n    /**\n     * 4D SuperSimplex noise, with XYZ oriented like noise3_ImproveXZ\n     * and W for an extra degree of freedom. W repeats eventually.\n     * Recommended for time-varied animations which texture a 3D object (W=time)\n     * in a space where Y is vertical\n     */\n    public static float noise4_ImproveXYZ_ImproveXZ(long seed, double x, double y, double z, double w) {\n        double xz = x + z;\n        double s2 = xz * -0.21132486540518699998;\n        double yy = y * 0.28867513459481294226;\n        double ww = w * 1.118033988749894;\n        double xr = x + (yy + ww + s2), zr = z + (yy + ww + s2);\n        double yr = xz * -0.57735026918962599998 + (yy + ww);\n        double wr = y * -0.866025403784439 + ww;\n\n        return noise4_UnskewedBase(seed, xr, yr, zr, wr);\n    }\n\n    /**\n     * 4D SuperSimplex noise, with XYZ oriented like noise3_Fallback\n     * and W for an extra degree of freedom. W repeats eventually.\n     * Recommended for time-varied animations which texture a 3D object (W=time)\n     * where there isn't a clear distinction between horizontal and vertical\n     */\n    public static float noise4_ImproveXYZ(long seed, double x, double y, double z, double w) {\n        double xyz = x + y + z;\n        double ww = w * 1.118033988749894;\n        double s2 = xyz * -0.16666666666666666 + ww;\n        double xs = x + s2, ys = y + s2, zs = z + s2, ws = -0.5 * xyz + ww;\n\n        return noise4_UnskewedBase(seed, xs, ys, zs, ws);\n    }\n    \n    /**\n     * 4D SuperSimplex noise, with XY and ZW forming orthogonal triangular-based planes.\n     * Recommended for 3D terrain, where X and Y (or Z and W) are horizontal.\n     * Recommended for noise(x, y, sin(time), cos(time)) trick.\n     */\n    public static float noise4_ImproveXY_ImproveZW(long seed, double x, double y, double z, double w) {\n        \n        double s2 = (x + y) * -0.28522513987434876941 + (z + w) * 0.83897065470611435718;\n        double t2 = (z + w) * 0.21939749883706435719 + (x + y) * -0.48214856493302476942;\n        double xs = x + s2, ys = y + s2, zs = z + t2, ws = w + t2;\n        \n        return noise4_UnskewedBase(seed, xs, ys, zs, ws);\n    }\n\n    /**\n     * 4D SuperSimplex noise, fallback lattice orientation.\n     */\n    public static float noise4_Fallback(long seed, double x, double y, double z, double w) {\n\n        // Get points for A4 lattice\n        double s = SKEW_4D * (x + y + z + w);\n        double xs = x + s, ys = y + s, zs = z + s, ws = w + s;\n\n        return noise4_UnskewedBase(seed, xs, ys, zs, ws);\n    }\n\n    /**\n     * 4D SuperSimplex noise base.\n     * Using ultra-simple 4x4x4x4 lookup partitioning.\n     * This isn't as elegant or SIMD/GPU/etc. portable as other approaches,\n     * but it competes performance-wise with optimized 2014 OpenSimplex.\n     */\n    private static float noise4_UnskewedBase(long seed, double xs, double ys, double zs, double ws) {\n\n        // Get base points and offsets\n        int xsb = fastFloor(xs), ysb = fastFloor(ys), zsb = fastFloor(zs), wsb = fastFloor(ws);\n        float xsi = (float)(xs - xsb), ysi = (float)(ys - ysb), zsi = (float)(zs - zsb), wsi = (float)(ws - wsb);\n\n        // Unskewed offsets\n        float ssi = (xsi + ysi + zsi + wsi) * UNSKEW_4D;\n        float xi = xsi + ssi, yi = ysi + ssi, zi = zsi + ssi, wi = wsi + ssi;\n\n        // Prime pre-multiplication for hash.\n        long xsvp = xsb * PRIME_X, ysvp = ysb * PRIME_Y, zsvp = zsb * PRIME_Z, wsvp = wsb * PRIME_W;\n\n        // Index into initial table.\n        int index = ((fastFloor(xs * 4) & 3) << 0)\n                | ((fastFloor(ys * 4) & 3) << 2)\n                | ((fastFloor(zs * 4) & 3) << 4)\n                | ((fastFloor(ws * 4) & 3) << 6);\n\n        // Point contributions\n        float value = 0;\n        int secondaryIndexStartAndStop = LOOKUP_4D_A[index];\n        int secondaryIndexStart = secondaryIndexStartAndStop & 0xFFFF;\n        int secondaryIndexStop = secondaryIndexStartAndStop >> 16;\n        for (int i = secondaryIndexStart; i < secondaryIndexStop; i++) {\n            LatticeVertex4D c = LOOKUP_4D_B[i];\n            float dx = xi + c.dx, dy = yi + c.dy, dz = zi + c.dz, dw = wi + c.dw;\n            float a = (dx * dx + dy * dy) + (dz * dz + dw * dw);\n            if (a < RSQUARED_4D) {\n                a -= RSQUARED_4D;\n                a *= a;\n                value += a * a * grad(seed, xsvp + c.xsvp, ysvp + c.ysvp, zsvp + c.zsvp, wsvp + c.wsvp, dx, dy, dz, dw);\n            }\n        }\n        return value;\n    }\n\n    /*\n     * Utility\n     */\n\n    private static float grad(long seed, long xsvp, long ysvp, float dx, float dy) {\n        long hash = seed ^ xsvp ^ ysvp;\n        hash *= HASH_MULTIPLIER;\n        hash ^= hash >> (64 - N_GRADS_2D_EXPONENT + 1);\n        int gi = (int)hash & ((N_GRADS_2D - 1) << 1);\n        return GRADIENTS_2D[gi | 0] * dx + GRADIENTS_2D[gi | 1] * dy;\n    }\n\n    private static float grad(long seed, long xrvp, long yrvp, long zrvp, float dx, float dy, float dz) {\n        long hash = (seed ^ xrvp) ^ (yrvp ^ zrvp);\n        hash *= HASH_MULTIPLIER;\n        hash ^= hash >> (64 - N_GRADS_3D_EXPONENT + 2);\n        int gi = (int)hash & ((N_GRADS_3D - 1) << 2);\n        return GRADIENTS_3D[gi | 0] * dx + GRADIENTS_3D[gi | 1] * dy + GRADIENTS_3D[gi | 2] * dz;\n    }\n\n    private static float grad(long seed, long xsvp, long ysvp, long zsvp, long wsvp, float dx, float dy, float dz, float dw) {\n        long hash = seed ^ (xsvp ^ ysvp) ^ (zsvp ^ wsvp);\n        hash *= HASH_MULTIPLIER;\n        hash ^= hash >> (64 - N_GRADS_4D_EXPONENT + 2);\n        int gi = (int)hash & ((N_GRADS_4D - 1) << 2);\n        return (GRADIENTS_4D[gi | 0] * dx + GRADIENTS_4D[gi | 1] * dy) + (GRADIENTS_4D[gi | 2] * dz + GRADIENTS_4D[gi | 3] * dw);\n    }\n\n    private static int fastFloor(double x) {\n        int xi = (int)x;\n        return x < xi ? xi - 1 : xi;\n    }\n\n    /*\n     * Lookup Tables & Gradients\n     */\n\n    private static float[] GRADIENTS_2D;\n    private static float[] GRADIENTS_3D;\n    private static float[] GRADIENTS_4D;\n    private static int[] LOOKUP_4D_A;\n    private static LatticeVertex4D[] LOOKUP_4D_B;\n    static {\n\n        GRADIENTS_2D = new float[N_GRADS_2D * 2];\n        float[] grad2 = {\n                0.38268343236509f,   0.923879532511287f,\n                0.923879532511287f,  0.38268343236509f,\n                0.923879532511287f, -0.38268343236509f,\n                0.38268343236509f,  -0.923879532511287f,\n                -0.38268343236509f,  -0.923879532511287f,\n                -0.923879532511287f, -0.38268343236509f,\n                -0.923879532511287f,  0.38268343236509f,\n                -0.38268343236509f,   0.923879532511287f,\n                //-------------------------------------//\n                0.130526192220052f,  0.99144486137381f,\n                0.608761429008721f,  0.793353340291235f,\n                0.793353340291235f,  0.608761429008721f,\n                0.99144486137381f,   0.130526192220051f,\n                0.99144486137381f,  -0.130526192220051f,\n                0.793353340291235f, -0.60876142900872f,\n                0.608761429008721f, -0.793353340291235f,\n                0.130526192220052f, -0.99144486137381f,\n                -0.130526192220052f, -0.99144486137381f,\n                -0.608761429008721f, -0.793353340291235f,\n                -0.793353340291235f, -0.608761429008721f,\n                -0.99144486137381f,  -0.130526192220052f,\n                -0.99144486137381f,   0.130526192220051f,\n                -0.793353340291235f,  0.608761429008721f,\n                -0.608761429008721f,  0.793353340291235f,\n                -0.130526192220052f,  0.99144486137381f,\n        };\n        for (int i = 0; i < grad2.length; i++) {\n            grad2[i] = (float)(grad2[i] / NORMALIZER_2D);\n        }\n        for (int i = 0, j = 0; i < GRADIENTS_2D.length; i++, j++) {\n            if (j == grad2.length) j = 0;\n            GRADIENTS_2D[i] = grad2[j];\n        }\n\n        GRADIENTS_3D = new float[N_GRADS_3D * 4];\n        float[] grad3 = {\n                2.22474487139f,       2.22474487139f,      -1.0f,                 0.0f,\n                2.22474487139f,       2.22474487139f,       1.0f,                 0.0f,\n                3.0862664687972017f,  1.1721513422464978f,  0.0f,                 0.0f,\n                1.1721513422464978f,  3.0862664687972017f,  0.0f,                 0.0f,\n                -2.22474487139f,       2.22474487139f,      -1.0f,                 0.0f,\n                -2.22474487139f,       2.22474487139f,       1.0f,                 0.0f,\n                -1.1721513422464978f,  3.0862664687972017f,  0.0f,                 0.0f,\n                -3.0862664687972017f,  1.1721513422464978f,  0.0f,                 0.0f,\n                -1.0f,                -2.22474487139f,      -2.22474487139f,       0.0f,\n                1.0f,                -2.22474487139f,      -2.22474487139f,       0.0f,\n                0.0f,                -3.0862664687972017f, -1.1721513422464978f,  0.0f,\n                0.0f,                -1.1721513422464978f, -3.0862664687972017f,  0.0f,\n                -1.0f,                -2.22474487139f,       2.22474487139f,       0.0f,\n                1.0f,                -2.22474487139f,       2.22474487139f,       0.0f,\n                0.0f,                -1.1721513422464978f,  3.0862664687972017f,  0.0f,\n                0.0f,                -3.0862664687972017f,  1.1721513422464978f,  0.0f,\n                //--------------------------------------------------------------------//\n                -2.22474487139f,      -2.22474487139f,      -1.0f,                 0.0f,\n                -2.22474487139f,      -2.22474487139f,       1.0f,                 0.0f,\n                -3.0862664687972017f, -1.1721513422464978f,  0.0f,                 0.0f,\n                -1.1721513422464978f, -3.0862664687972017f,  0.0f,                 0.0f,\n                -2.22474487139f,      -1.0f,                -2.22474487139f,       0.0f,\n                -2.22474487139f,       1.0f,                -2.22474487139f,       0.0f,\n                -1.1721513422464978f,  0.0f,                -3.0862664687972017f,  0.0f,\n                -3.0862664687972017f,  0.0f,                -1.1721513422464978f,  0.0f,\n                -2.22474487139f,      -1.0f,                 2.22474487139f,       0.0f,\n                -2.22474487139f,       1.0f,                 2.22474487139f,       0.0f,\n                -3.0862664687972017f,  0.0f,                 1.1721513422464978f,  0.0f,\n                -1.1721513422464978f,  0.0f,                 3.0862664687972017f,  0.0f,\n                -1.0f,                 2.22474487139f,      -2.22474487139f,       0.0f,\n                1.0f,                 2.22474487139f,      -2.22474487139f,       0.0f,\n                0.0f,                 1.1721513422464978f, -3.0862664687972017f,  0.0f,\n                0.0f,                 3.0862664687972017f, -1.1721513422464978f,  0.0f,\n                -1.0f,                 2.22474487139f,       2.22474487139f,       0.0f,\n                1.0f,                 2.22474487139f,       2.22474487139f,       0.0f,\n                0.0f,                 3.0862664687972017f,  1.1721513422464978f,  0.0f,\n                0.0f,                 1.1721513422464978f,  3.0862664687972017f,  0.0f,\n                2.22474487139f,      -2.22474487139f,      -1.0f,                 0.0f,\n                2.22474487139f,      -2.22474487139f,       1.0f,                 0.0f,\n                1.1721513422464978f, -3.0862664687972017f,  0.0f,                 0.0f,\n                3.0862664687972017f, -1.1721513422464978f,  0.0f,                 0.0f,\n                2.22474487139f,      -1.0f,                -2.22474487139f,       0.0f,\n                2.22474487139f,       1.0f,                -2.22474487139f,       0.0f,\n                3.0862664687972017f,  0.0f,                -1.1721513422464978f,  0.0f,\n                1.1721513422464978f,  0.0f,                -3.0862664687972017f,  0.0f,\n                2.22474487139f,      -1.0f,                 2.22474487139f,       0.0f,\n                2.22474487139f,       1.0f,                 2.22474487139f,       0.0f,\n                1.1721513422464978f,  0.0f,                 3.0862664687972017f,  0.0f,\n                3.0862664687972017f,  0.0f,                 1.1721513422464978f,  0.0f,\n        };\n        for (int i = 0; i < grad3.length; i++) {\n            grad3[i] = (float)(grad3[i] / NORMALIZER_3D);\n        }\n        for (int i = 0, j = 0; i < GRADIENTS_3D.length; i++, j++) {\n            if (j == grad3.length) j = 0;\n            GRADIENTS_3D[i] = grad3[j];\n        }\n\n        GRADIENTS_4D = new float[N_GRADS_4D * 4];\n        float[] grad4 = {\n                -0.6740059517812944f,   -0.3239847771997537f,   -0.3239847771997537f,    0.5794684678643381f,\n                -0.7504883828755602f,   -0.4004672082940195f,    0.15296486218853164f,   0.5029860367700724f,\n                -0.7504883828755602f,    0.15296486218853164f,  -0.4004672082940195f,    0.5029860367700724f,\n                -0.8828161875373585f,    0.08164729285680945f,   0.08164729285680945f,   0.4553054119602712f,\n                -0.4553054119602712f,   -0.08164729285680945f,  -0.08164729285680945f,   0.8828161875373585f,\n                -0.5029860367700724f,   -0.15296486218853164f,   0.4004672082940195f,    0.7504883828755602f,\n                -0.5029860367700724f,    0.4004672082940195f,   -0.15296486218853164f,   0.7504883828755602f,\n                -0.5794684678643381f,    0.3239847771997537f,    0.3239847771997537f,    0.6740059517812944f,\n                -0.6740059517812944f,   -0.3239847771997537f,    0.5794684678643381f,   -0.3239847771997537f,\n                -0.7504883828755602f,   -0.4004672082940195f,    0.5029860367700724f,    0.15296486218853164f,\n                -0.7504883828755602f,    0.15296486218853164f,   0.5029860367700724f,   -0.4004672082940195f,\n                -0.8828161875373585f,    0.08164729285680945f,   0.4553054119602712f,    0.08164729285680945f,\n                -0.4553054119602712f,   -0.08164729285680945f,   0.8828161875373585f,   -0.08164729285680945f,\n                -0.5029860367700724f,   -0.15296486218853164f,   0.7504883828755602f,    0.4004672082940195f,\n                -0.5029860367700724f,    0.4004672082940195f,    0.7504883828755602f,   -0.15296486218853164f,\n                -0.5794684678643381f,    0.3239847771997537f,    0.6740059517812944f,    0.3239847771997537f,\n                -0.6740059517812944f,    0.5794684678643381f,   -0.3239847771997537f,   -0.3239847771997537f,\n                -0.7504883828755602f,    0.5029860367700724f,   -0.4004672082940195f,    0.15296486218853164f,\n                -0.7504883828755602f,    0.5029860367700724f,    0.15296486218853164f,  -0.4004672082940195f,\n                -0.8828161875373585f,    0.4553054119602712f,    0.08164729285680945f,   0.08164729285680945f,\n                -0.4553054119602712f,    0.8828161875373585f,   -0.08164729285680945f,  -0.08164729285680945f,\n                -0.5029860367700724f,    0.7504883828755602f,   -0.15296486218853164f,   0.4004672082940195f,\n                -0.5029860367700724f,    0.7504883828755602f,    0.4004672082940195f,   -0.15296486218853164f,\n                -0.5794684678643381f,    0.6740059517812944f,    0.3239847771997537f,    0.3239847771997537f,\n                0.5794684678643381f,   -0.6740059517812944f,   -0.3239847771997537f,   -0.3239847771997537f,\n                0.5029860367700724f,   -0.7504883828755602f,   -0.4004672082940195f,    0.15296486218853164f,\n                0.5029860367700724f,   -0.7504883828755602f,    0.15296486218853164f,  -0.4004672082940195f,\n                0.4553054119602712f,   -0.8828161875373585f,    0.08164729285680945f,   0.08164729285680945f,\n                0.8828161875373585f,   -0.4553054119602712f,   -0.08164729285680945f,  -0.08164729285680945f,\n                0.7504883828755602f,   -0.5029860367700724f,   -0.15296486218853164f,   0.4004672082940195f,\n                0.7504883828755602f,   -0.5029860367700724f,    0.4004672082940195f,   -0.15296486218853164f,\n                0.6740059517812944f,   -0.5794684678643381f,    0.3239847771997537f,    0.3239847771997537f,\n                //------------------------------------------------------------------------------------------//\n                -0.753341017856078f,    -0.37968289875261624f,  -0.37968289875261624f,  -0.37968289875261624f,\n                -0.7821684431180708f,   -0.4321472685365301f,   -0.4321472685365301f,    0.12128480194602098f,\n                -0.7821684431180708f,   -0.4321472685365301f,    0.12128480194602098f,  -0.4321472685365301f,\n                -0.7821684431180708f,    0.12128480194602098f,  -0.4321472685365301f,   -0.4321472685365301f,\n                -0.8586508742123365f,   -0.508629699630796f,     0.044802370851755174f,  0.044802370851755174f,\n                -0.8586508742123365f,    0.044802370851755174f, -0.508629699630796f,     0.044802370851755174f,\n                -0.8586508742123365f,    0.044802370851755174f,  0.044802370851755174f, -0.508629699630796f,\n                -0.9982828964265062f,   -0.03381941603233842f,  -0.03381941603233842f,  -0.03381941603233842f,\n                -0.37968289875261624f,  -0.753341017856078f,    -0.37968289875261624f,  -0.37968289875261624f,\n                -0.4321472685365301f,   -0.7821684431180708f,   -0.4321472685365301f,    0.12128480194602098f,\n                -0.4321472685365301f,   -0.7821684431180708f,    0.12128480194602098f,  -0.4321472685365301f,\n                0.12128480194602098f,  -0.7821684431180708f,   -0.4321472685365301f,   -0.4321472685365301f,\n                -0.508629699630796f,    -0.8586508742123365f,    0.044802370851755174f,  0.044802370851755174f,\n                0.044802370851755174f, -0.8586508742123365f,   -0.508629699630796f,     0.044802370851755174f,\n                0.044802370851755174f, -0.8586508742123365f,    0.044802370851755174f, -0.508629699630796f,\n                -0.03381941603233842f,  -0.9982828964265062f,   -0.03381941603233842f,  -0.03381941603233842f,\n                -0.37968289875261624f,  -0.37968289875261624f,  -0.753341017856078f,    -0.37968289875261624f,\n                -0.4321472685365301f,   -0.4321472685365301f,   -0.7821684431180708f,    0.12128480194602098f,\n                -0.4321472685365301f,    0.12128480194602098f,  -0.7821684431180708f,   -0.4321472685365301f,\n                0.12128480194602098f,  -0.4321472685365301f,   -0.7821684431180708f,   -0.4321472685365301f,\n                -0.508629699630796f,     0.044802370851755174f, -0.8586508742123365f,    0.044802370851755174f,\n                0.044802370851755174f, -0.508629699630796f,    -0.8586508742123365f,    0.044802370851755174f,\n                0.044802370851755174f,  0.044802370851755174f, -0.8586508742123365f,   -0.508629699630796f,\n                -0.03381941603233842f,  -0.03381941603233842f,  -0.9982828964265062f,   -0.03381941603233842f,\n                -0.37968289875261624f,  -0.37968289875261624f,  -0.37968289875261624f,  -0.753341017856078f,\n                -0.4321472685365301f,   -0.4321472685365301f,    0.12128480194602098f,  -0.7821684431180708f,\n                -0.4321472685365301f,    0.12128480194602098f,  -0.4321472685365301f,   -0.7821684431180708f,\n                0.12128480194602098f,  -0.4321472685365301f,   -0.4321472685365301f,   -0.7821684431180708f,\n                -0.508629699630796f,     0.044802370851755174f,  0.044802370851755174f, -0.8586508742123365f,\n                0.044802370851755174f, -0.508629699630796f,     0.044802370851755174f, -0.8586508742123365f,\n                0.044802370851755174f,  0.044802370851755174f, -0.508629699630796f,    -0.8586508742123365f,\n                -0.03381941603233842f,  -0.03381941603233842f,  -0.03381941603233842f,  -0.9982828964265062f,\n                -0.3239847771997537f,   -0.6740059517812944f,   -0.3239847771997537f,    0.5794684678643381f,\n                -0.4004672082940195f,   -0.7504883828755602f,    0.15296486218853164f,   0.5029860367700724f,\n                0.15296486218853164f,  -0.7504883828755602f,   -0.4004672082940195f,    0.5029860367700724f,\n                0.08164729285680945f,  -0.8828161875373585f,    0.08164729285680945f,   0.4553054119602712f,\n                -0.08164729285680945f,  -0.4553054119602712f,   -0.08164729285680945f,   0.8828161875373585f,\n                -0.15296486218853164f,  -0.5029860367700724f,    0.4004672082940195f,    0.7504883828755602f,\n                0.4004672082940195f,   -0.5029860367700724f,   -0.15296486218853164f,   0.7504883828755602f,\n                0.3239847771997537f,   -0.5794684678643381f,    0.3239847771997537f,    0.6740059517812944f,\n                -0.3239847771997537f,   -0.3239847771997537f,   -0.6740059517812944f,    0.5794684678643381f,\n                -0.4004672082940195f,    0.15296486218853164f,  -0.7504883828755602f,    0.5029860367700724f,\n                0.15296486218853164f,  -0.4004672082940195f,   -0.7504883828755602f,    0.5029860367700724f,\n                0.08164729285680945f,   0.08164729285680945f,  -0.8828161875373585f,    0.4553054119602712f,\n                -0.08164729285680945f,  -0.08164729285680945f,  -0.4553054119602712f,    0.8828161875373585f,\n                -0.15296486218853164f,   0.4004672082940195f,   -0.5029860367700724f,    0.7504883828755602f,\n                0.4004672082940195f,   -0.15296486218853164f,  -0.5029860367700724f,    0.7504883828755602f,\n                0.3239847771997537f,    0.3239847771997537f,   -0.5794684678643381f,    0.6740059517812944f,\n                -0.3239847771997537f,   -0.6740059517812944f,    0.5794684678643381f,   -0.3239847771997537f,\n                -0.4004672082940195f,   -0.7504883828755602f,    0.5029860367700724f,    0.15296486218853164f,\n                0.15296486218853164f,  -0.7504883828755602f,    0.5029860367700724f,   -0.4004672082940195f,\n                0.08164729285680945f,  -0.8828161875373585f,    0.4553054119602712f,    0.08164729285680945f,\n                -0.08164729285680945f,  -0.4553054119602712f,    0.8828161875373585f,   -0.08164729285680945f,\n                -0.15296486218853164f,  -0.5029860367700724f,    0.7504883828755602f,    0.4004672082940195f,\n                0.4004672082940195f,   -0.5029860367700724f,    0.7504883828755602f,   -0.15296486218853164f,\n                0.3239847771997537f,   -0.5794684678643381f,    0.6740059517812944f,    0.3239847771997537f,\n                -0.3239847771997537f,   -0.3239847771997537f,    0.5794684678643381f,   -0.6740059517812944f,\n                -0.4004672082940195f,    0.15296486218853164f,   0.5029860367700724f,   -0.7504883828755602f,\n                0.15296486218853164f,  -0.4004672082940195f,    0.5029860367700724f,   -0.7504883828755602f,\n                0.08164729285680945f,   0.08164729285680945f,   0.4553054119602712f,   -0.8828161875373585f,\n                -0.08164729285680945f,  -0.08164729285680945f,   0.8828161875373585f,   -0.4553054119602712f,\n                -0.15296486218853164f,   0.4004672082940195f,    0.7504883828755602f,   -0.5029860367700724f,\n                0.4004672082940195f,   -0.15296486218853164f,   0.7504883828755602f,   -0.5029860367700724f,\n                0.3239847771997537f,    0.3239847771997537f,    0.6740059517812944f,   -0.5794684678643381f,\n                -0.3239847771997537f,    0.5794684678643381f,   -0.6740059517812944f,   -0.3239847771997537f,\n                -0.4004672082940195f,    0.5029860367700724f,   -0.7504883828755602f,    0.15296486218853164f,\n                0.15296486218853164f,   0.5029860367700724f,   -0.7504883828755602f,   -0.4004672082940195f,\n                0.08164729285680945f,   0.4553054119602712f,   -0.8828161875373585f,    0.08164729285680945f,\n                -0.08164729285680945f,   0.8828161875373585f,   -0.4553054119602712f,   -0.08164729285680945f,\n                -0.15296486218853164f,   0.7504883828755602f,   -0.5029860367700724f,    0.4004672082940195f,\n                0.4004672082940195f,    0.7504883828755602f,   -0.5029860367700724f,   -0.15296486218853164f,\n                0.3239847771997537f,    0.6740059517812944f,   -0.5794684678643381f,    0.3239847771997537f,\n                -0.3239847771997537f,    0.5794684678643381f,   -0.3239847771997537f,   -0.6740059517812944f,\n                -0.4004672082940195f,    0.5029860367700724f,    0.15296486218853164f,  -0.7504883828755602f,\n                0.15296486218853164f,   0.5029860367700724f,   -0.4004672082940195f,   -0.7504883828755602f,\n                0.08164729285680945f,   0.4553054119602712f,    0.08164729285680945f,  -0.8828161875373585f,\n                -0.08164729285680945f,   0.8828161875373585f,   -0.08164729285680945f,  -0.4553054119602712f,\n                -0.15296486218853164f,   0.7504883828755602f,    0.4004672082940195f,   -0.5029860367700724f,\n                0.4004672082940195f,    0.7504883828755602f,   -0.15296486218853164f,  -0.5029860367700724f,\n                0.3239847771997537f,    0.6740059517812944f,    0.3239847771997537f,   -0.5794684678643381f,\n                0.5794684678643381f,   -0.3239847771997537f,   -0.6740059517812944f,   -0.3239847771997537f,\n                0.5029860367700724f,   -0.4004672082940195f,   -0.7504883828755602f,    0.15296486218853164f,\n                0.5029860367700724f,    0.15296486218853164f,  -0.7504883828755602f,   -0.4004672082940195f,\n                0.4553054119602712f,    0.08164729285680945f,  -0.8828161875373585f,    0.08164729285680945f,\n                0.8828161875373585f,   -0.08164729285680945f,  -0.4553054119602712f,   -0.08164729285680945f,\n                0.7504883828755602f,   -0.15296486218853164f,  -0.5029860367700724f,    0.4004672082940195f,\n                0.7504883828755602f,    0.4004672082940195f,   -0.5029860367700724f,   -0.15296486218853164f,\n                0.6740059517812944f,    0.3239847771997537f,   -0.5794684678643381f,    0.3239847771997537f,\n                0.5794684678643381f,   -0.3239847771997537f,   -0.3239847771997537f,   -0.6740059517812944f,\n                0.5029860367700724f,   -0.4004672082940195f,    0.15296486218853164f,  -0.7504883828755602f,\n                0.5029860367700724f,    0.15296486218853164f,  -0.4004672082940195f,   -0.7504883828755602f,\n                0.4553054119602712f,    0.08164729285680945f,   0.08164729285680945f,  -0.8828161875373585f,\n                0.8828161875373585f,   -0.08164729285680945f,  -0.08164729285680945f,  -0.4553054119602712f,\n                0.7504883828755602f,   -0.15296486218853164f,   0.4004672082940195f,   -0.5029860367700724f,\n                0.7504883828755602f,    0.4004672082940195f,   -0.15296486218853164f,  -0.5029860367700724f,\n                0.6740059517812944f,    0.3239847771997537f,    0.3239847771997537f,   -0.5794684678643381f,\n                0.03381941603233842f,   0.03381941603233842f,   0.03381941603233842f,   0.9982828964265062f,\n                -0.044802370851755174f, -0.044802370851755174f,  0.508629699630796f,     0.8586508742123365f,\n                -0.044802370851755174f,  0.508629699630796f,    -0.044802370851755174f,  0.8586508742123365f,\n                -0.12128480194602098f,   0.4321472685365301f,    0.4321472685365301f,    0.7821684431180708f,\n                0.508629699630796f,    -0.044802370851755174f, -0.044802370851755174f,  0.8586508742123365f,\n                0.4321472685365301f,   -0.12128480194602098f,   0.4321472685365301f,    0.7821684431180708f,\n                0.4321472685365301f,    0.4321472685365301f,   -0.12128480194602098f,   0.7821684431180708f,\n                0.37968289875261624f,   0.37968289875261624f,   0.37968289875261624f,   0.753341017856078f,\n                0.03381941603233842f,   0.03381941603233842f,   0.9982828964265062f,    0.03381941603233842f,\n                -0.044802370851755174f,  0.044802370851755174f,  0.8586508742123365f,    0.508629699630796f,\n                -0.044802370851755174f,  0.508629699630796f,     0.8586508742123365f,   -0.044802370851755174f,\n                -0.12128480194602098f,   0.4321472685365301f,    0.7821684431180708f,    0.4321472685365301f,\n                0.508629699630796f,    -0.044802370851755174f,  0.8586508742123365f,   -0.044802370851755174f,\n                0.4321472685365301f,   -0.12128480194602098f,   0.7821684431180708f,    0.4321472685365301f,\n                0.4321472685365301f,    0.4321472685365301f,    0.7821684431180708f,   -0.12128480194602098f,\n                0.37968289875261624f,   0.37968289875261624f,   0.753341017856078f,     0.37968289875261624f,\n                0.03381941603233842f,   0.9982828964265062f,    0.03381941603233842f,   0.03381941603233842f,\n                -0.044802370851755174f,  0.8586508742123365f,   -0.044802370851755174f,  0.508629699630796f,\n                -0.044802370851755174f,  0.8586508742123365f,    0.508629699630796f,    -0.044802370851755174f,\n                -0.12128480194602098f,   0.7821684431180708f,    0.4321472685365301f,    0.4321472685365301f,\n                0.508629699630796f,     0.8586508742123365f,   -0.044802370851755174f, -0.044802370851755174f,\n                0.4321472685365301f,    0.7821684431180708f,   -0.12128480194602098f,   0.4321472685365301f,\n                0.4321472685365301f,    0.7821684431180708f,    0.4321472685365301f,   -0.12128480194602098f,\n                0.37968289875261624f,   0.753341017856078f,     0.37968289875261624f,   0.37968289875261624f,\n                0.9982828964265062f,    0.03381941603233842f,   0.03381941603233842f,   0.03381941603233842f,\n                0.8586508742123365f,   -0.044802370851755174f, -0.044802370851755174f,  0.508629699630796f,\n                0.8586508742123365f,   -0.044802370851755174f,  0.508629699630796f,    -0.044802370851755174f,\n                0.7821684431180708f,   -0.12128480194602098f,   0.4321472685365301f,    0.4321472685365301f,\n                0.8586508742123365f,    0.508629699630796f,    -0.044802370851755174f, -0.044802370851755174f,\n                0.7821684431180708f,    0.4321472685365301f,   -0.12128480194602098f,   0.4321472685365301f,\n                0.7821684431180708f,    0.4321472685365301f,    0.4321472685365301f,   -0.12128480194602098f,\n                0.753341017856078f,     0.37968289875261624f,   0.37968289875261624f,   0.37968289875261624f,\n        };\n        for (int i = 0; i < grad4.length; i++) {\n            grad4[i] = (float)(grad4[i] / NORMALIZER_4D);\n        }\n        for (int i = 0, j = 0; i < GRADIENTS_4D.length; i++, j++) {\n            if (j == grad4.length) j = 0;\n            GRADIENTS_4D[i] = grad4[j];\n        }\n\n        int[][] lookup4DVertexCodes = {\n                new int[] { 0x15, 0x45, 0x51, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x15, 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xAA },\n                new int[] { 0x01, 0x05, 0x11, 0x15, 0x41, 0x45, 0x51, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA },\n                new int[] { 0x01, 0x15, 0x16, 0x45, 0x46, 0x51, 0x52, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x15, 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA9, 0xAA },\n                new int[] { 0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xAA },\n                new int[] { 0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xAA },\n                new int[] { 0x05, 0x15, 0x16, 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xAA, 0xAB },\n                new int[] { 0x04, 0x05, 0x14, 0x15, 0x44, 0x45, 0x54, 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA },\n                new int[] { 0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xAA },\n                new int[] { 0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x9A, 0xAA },\n                new int[] { 0x05, 0x15, 0x16, 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x5B, 0x6A, 0x9A, 0xAA, 0xAB },\n                new int[] { 0x04, 0x15, 0x19, 0x45, 0x49, 0x54, 0x55, 0x58, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x05, 0x15, 0x19, 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xAA, 0xAE },\n                new int[] { 0x05, 0x15, 0x19, 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x5E, 0x6A, 0x9A, 0xAA, 0xAE },\n                new int[] { 0x05, 0x15, 0x1A, 0x45, 0x4A, 0x55, 0x56, 0x59, 0x5A, 0x5B, 0x5E, 0x6A, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n                new int[] { 0x15, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x11, 0x15, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xAA },\n                new int[] { 0x11, 0x15, 0x51, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x96, 0xA6, 0xAA },\n                new int[] { 0x11, 0x15, 0x16, 0x51, 0x52, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x96, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x14, 0x15, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA9, 0xAA },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x9A, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x15, 0x16, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x6B, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x14, 0x15, 0x54, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x99, 0xA9, 0xAA },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x9A, 0xAA },\n                new int[] { 0x15, 0x16, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x6B, 0x9A, 0xAA, 0xAB },\n                new int[] { 0x14, 0x15, 0x19, 0x54, 0x55, 0x58, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x99, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x15, 0x19, 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x6E, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x15, 0x19, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x6E, 0x9A, 0xAA, 0xAE },\n                new int[] { 0x15, 0x1A, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x6B, 0x6E, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n                new int[] { 0x10, 0x11, 0x14, 0x15, 0x50, 0x51, 0x54, 0x55, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x11, 0x15, 0x51, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xAA },\n                new int[] { 0x11, 0x15, 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0xA6, 0xAA },\n                new int[] { 0x11, 0x15, 0x16, 0x51, 0x52, 0x55, 0x56, 0x65, 0x66, 0x67, 0x6A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x14, 0x15, 0x54, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA9, 0xAA },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA6, 0xAA },\n                new int[] { 0x15, 0x16, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x6B, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x14, 0x15, 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0xA9, 0xAA },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA9, 0xAA },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xAA },\n                new int[] { 0x15, 0x16, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6B, 0xAA, 0xAB },\n                new int[] { 0x14, 0x15, 0x19, 0x54, 0x55, 0x58, 0x59, 0x65, 0x69, 0x6A, 0x6D, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x15, 0x19, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x6E, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x15, 0x19, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6E, 0xAA, 0xAE },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x69, 0x6A, 0x6B, 0x6E, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n                new int[] { 0x10, 0x15, 0x25, 0x51, 0x54, 0x55, 0x61, 0x64, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x11, 0x15, 0x25, 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xAA, 0xBA },\n                new int[] { 0x11, 0x15, 0x25, 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x6A, 0x76, 0xA6, 0xAA, 0xBA },\n                new int[] { 0x11, 0x15, 0x26, 0x51, 0x55, 0x56, 0x62, 0x65, 0x66, 0x67, 0x6A, 0x76, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n                new int[] { 0x14, 0x15, 0x25, 0x54, 0x55, 0x59, 0x64, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x15, 0x25, 0x55, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x15, 0x25, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xA6, 0xAA, 0xBA },\n                new int[] { 0x15, 0x26, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x6B, 0x7A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n                new int[] { 0x14, 0x15, 0x25, 0x54, 0x55, 0x59, 0x64, 0x65, 0x69, 0x6A, 0x79, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x15, 0x25, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x15, 0x25, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xAA, 0xBA },\n                new int[] { 0x15, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6B, 0x7A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n                new int[] { 0x14, 0x15, 0x29, 0x54, 0x55, 0x59, 0x65, 0x68, 0x69, 0x6A, 0x6D, 0x79, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n                new int[] { 0x15, 0x29, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x6E, 0x7A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n                new int[] { 0x15, 0x55, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6E, 0x7A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6B, 0x6E, 0x7A, 0xAA, 0xAB, 0xAE, 0xBA, 0xBF },\n                new int[] { 0x45, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xAA },\n                new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x5A, 0x66, 0x95, 0x96, 0x9A, 0xA6, 0xAA },\n                new int[] { 0x41, 0x45, 0x46, 0x51, 0x52, 0x55, 0x56, 0x5A, 0x66, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x44, 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA9, 0xAA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x45, 0x46, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x44, 0x45, 0x54, 0x55, 0x59, 0x5A, 0x69, 0x95, 0x99, 0x9A, 0xA9, 0xAA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xAA },\n                new int[] { 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x96, 0x9A, 0x9B, 0xAA, 0xAB },\n                new int[] { 0x44, 0x45, 0x49, 0x54, 0x55, 0x58, 0x59, 0x5A, 0x69, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x45, 0x49, 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x99, 0x9A, 0x9E, 0xAA, 0xAE },\n                new int[] { 0x45, 0x4A, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x9A, 0x9B, 0x9E, 0xAA, 0xAB, 0xAE, 0xAF },\n                new int[] { 0x50, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x95, 0x96, 0x99, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x51, 0x55, 0x56, 0x59, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x51, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x51, 0x52, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xA7, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x56, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x15, 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x15, 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x58, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAD, 0xAE },\n                new int[] { 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n                new int[] { 0x50, 0x51, 0x54, 0x55, 0x65, 0x66, 0x69, 0x95, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xAA },\n                new int[] { 0x51, 0x52, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x96, 0xA6, 0xA7, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x15, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x15, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xBA },\n                new int[] { 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA9, 0xAA },\n                new int[] { 0x15, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xBA },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x9A, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x58, 0x59, 0x65, 0x69, 0x6A, 0x99, 0xA9, 0xAA, 0xAD, 0xAE },\n                new int[] { 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x69, 0x6A, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n                new int[] { 0x50, 0x51, 0x54, 0x55, 0x61, 0x64, 0x65, 0x66, 0x69, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x51, 0x55, 0x61, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA },\n                new int[] { 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x6A, 0xA5, 0xA6, 0xAA, 0xB6, 0xBA },\n                new int[] { 0x51, 0x55, 0x56, 0x62, 0x65, 0x66, 0x6A, 0xA6, 0xA7, 0xAA, 0xAB, 0xB6, 0xBA, 0xBB },\n                new int[] { 0x54, 0x55, 0x64, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA },\n                new int[] { 0x55, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x55, 0x56, 0x65, 0x66, 0x6A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n                new int[] { 0x54, 0x55, 0x59, 0x64, 0x65, 0x69, 0x6A, 0xA5, 0xA9, 0xAA, 0xB9, 0xBA },\n                new int[] { 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x15, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x68, 0x69, 0x6A, 0xA9, 0xAA, 0xAD, 0xAE, 0xB9, 0xBA, 0xBE },\n                new int[] { 0x55, 0x59, 0x65, 0x69, 0x6A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n                new int[] { 0x15, 0x55, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xAA, 0xAB, 0xAE, 0xBA, 0xBF },\n                new int[] { 0x40, 0x41, 0x44, 0x45, 0x50, 0x51, 0x54, 0x55, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xAA },\n                new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x95, 0x96, 0x9A, 0xA6, 0xAA },\n                new int[] { 0x41, 0x45, 0x46, 0x51, 0x52, 0x55, 0x56, 0x95, 0x96, 0x97, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x44, 0x45, 0x54, 0x55, 0x59, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA9, 0xAA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA },\n                new int[] { 0x45, 0x46, 0x55, 0x56, 0x5A, 0x95, 0x96, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x44, 0x45, 0x54, 0x55, 0x59, 0x95, 0x99, 0x9A, 0xA9, 0xAA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xAA },\n                new int[] { 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9B, 0xAA, 0xAB },\n                new int[] { 0x44, 0x45, 0x49, 0x54, 0x55, 0x58, 0x59, 0x95, 0x99, 0x9A, 0x9D, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x45, 0x49, 0x55, 0x59, 0x5A, 0x95, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9E, 0xAA, 0xAE },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x96, 0x99, 0x9A, 0x9B, 0x9E, 0xAA, 0xAB, 0xAE, 0xAF },\n                new int[] { 0x50, 0x51, 0x54, 0x55, 0x65, 0x95, 0x96, 0x99, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA },\n                new int[] { 0x51, 0x52, 0x55, 0x56, 0x66, 0x95, 0x96, 0x9A, 0xA6, 0xA7, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x45, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xEA },\n                new int[] { 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA },\n                new int[] { 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xEA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x58, 0x59, 0x69, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAD, 0xAE },\n                new int[] { 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x96, 0x99, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF },\n                new int[] { 0x50, 0x51, 0x54, 0x55, 0x65, 0x95, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xAA },\n                new int[] { 0x51, 0x52, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x51, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB },\n                new int[] { 0x54, 0x55, 0x58, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE },\n                new int[] { 0x54, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAE },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x66, 0x69, 0x6A, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xAF },\n                new int[] { 0x50, 0x51, 0x54, 0x55, 0x61, 0x64, 0x65, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xB5, 0xBA },\n                new int[] { 0x51, 0x55, 0x61, 0x65, 0x66, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA },\n                new int[] { 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0xB6, 0xBA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x96, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB, 0xB6, 0xBA, 0xBB },\n                new int[] { 0x54, 0x55, 0x64, 0x65, 0x69, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA },\n                new int[] { 0x55, 0x65, 0x66, 0x69, 0x6A, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x96, 0xA5, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB },\n                new int[] { 0x54, 0x55, 0x59, 0x64, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xB9, 0xBA },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA },\n                new int[] { 0x55, 0x56, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xBA, 0xBB },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x99, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE, 0xB9, 0xBA, 0xBE },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x99, 0xA5, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n                new int[] { 0x55, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xBA },\n                new int[] { 0x40, 0x45, 0x51, 0x54, 0x55, 0x85, 0x91, 0x94, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x85, 0x91, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xAA, 0xEA },\n                new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x85, 0x91, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xD6, 0xEA },\n                new int[] { 0x41, 0x45, 0x51, 0x55, 0x56, 0x86, 0x92, 0x95, 0x96, 0x97, 0x9A, 0xA6, 0xAA, 0xAB, 0xD6, 0xEA, 0xEB },\n                new int[] { 0x44, 0x45, 0x54, 0x55, 0x59, 0x85, 0x94, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x45, 0x55, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xDA, 0xEA },\n                new int[] { 0x45, 0x55, 0x56, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xDA, 0xEA },\n                new int[] { 0x45, 0x55, 0x56, 0x86, 0x95, 0x96, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB, 0xDA, 0xEA, 0xEB },\n                new int[] { 0x44, 0x45, 0x54, 0x55, 0x59, 0x85, 0x94, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xD9, 0xEA },\n                new int[] { 0x45, 0x55, 0x59, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xDA, 0xEA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xAA, 0xDA, 0xEA },\n                new int[] { 0x45, 0x55, 0x56, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB, 0xDA, 0xEA, 0xEB },\n                new int[] { 0x44, 0x45, 0x54, 0x55, 0x59, 0x89, 0x95, 0x98, 0x99, 0x9A, 0x9D, 0xA9, 0xAA, 0xAE, 0xD9, 0xEA, 0xEE },\n                new int[] { 0x45, 0x55, 0x59, 0x89, 0x95, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE, 0xDA, 0xEA, 0xEE },\n                new int[] { 0x45, 0x55, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE, 0xDA, 0xEA, 0xEE },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9B, 0x9E, 0xAA, 0xAB, 0xAE, 0xDA, 0xEA, 0xEF },\n                new int[] { 0x50, 0x51, 0x54, 0x55, 0x65, 0x91, 0x94, 0x95, 0x96, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x51, 0x55, 0x91, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xE6, 0xEA },\n                new int[] { 0x51, 0x55, 0x56, 0x91, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xE6, 0xEA },\n                new int[] { 0x51, 0x55, 0x56, 0x92, 0x95, 0x96, 0x9A, 0xA6, 0xA7, 0xAA, 0xAB, 0xE6, 0xEA, 0xEB },\n                new int[] { 0x54, 0x55, 0x94, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xE9, 0xEA },\n                new int[] { 0x55, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x55, 0x56, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x55, 0x56, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB, 0xEA, 0xEB },\n                new int[] { 0x54, 0x55, 0x59, 0x94, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xE9, 0xEA },\n                new int[] { 0x55, 0x59, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x45, 0x55, 0x56, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xAB, 0xEA, 0xEB },\n                new int[] { 0x54, 0x55, 0x59, 0x95, 0x98, 0x99, 0x9A, 0xA9, 0xAA, 0xAD, 0xAE, 0xE9, 0xEA, 0xEE },\n                new int[] { 0x55, 0x59, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE },\n                new int[] { 0x45, 0x55, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xAA, 0xAB, 0xAE, 0xEA, 0xEF },\n                new int[] { 0x50, 0x51, 0x54, 0x55, 0x65, 0x91, 0x94, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xE5, 0xEA },\n                new int[] { 0x51, 0x55, 0x65, 0x91, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xE6, 0xEA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x91, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0xE6, 0xEA },\n                new int[] { 0x51, 0x55, 0x56, 0x66, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB, 0xE6, 0xEA, 0xEB },\n                new int[] { 0x54, 0x55, 0x65, 0x94, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xE9, 0xEA },\n                new int[] { 0x55, 0x65, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x51, 0x55, 0x56, 0x66, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xAB, 0xEA, 0xEB },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x94, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xE9, 0xEA },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x55, 0x56, 0x59, 0x65, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA },\n                new int[] { 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xEA, 0xEB },\n                new int[] { 0x54, 0x55, 0x59, 0x69, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE, 0xE9, 0xEA, 0xEE },\n                new int[] { 0x54, 0x55, 0x59, 0x69, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE },\n                new int[] { 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xEA },\n                new int[] { 0x50, 0x51, 0x54, 0x55, 0x65, 0x95, 0xA1, 0xA4, 0xA5, 0xA6, 0xA9, 0xAA, 0xB5, 0xBA, 0xE5, 0xEA, 0xFA },\n                new int[] { 0x51, 0x55, 0x65, 0x95, 0xA1, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA, 0xE6, 0xEA, 0xFA },\n                new int[] { 0x51, 0x55, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA, 0xE6, 0xEA, 0xFA },\n                new int[] { 0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB, 0xB6, 0xBA, 0xE6, 0xEA, 0xFB },\n                new int[] { 0x54, 0x55, 0x65, 0x95, 0xA4, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA, 0xE9, 0xEA, 0xFA },\n                new int[] { 0x55, 0x65, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA },\n                new int[] { 0x51, 0x55, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA },\n                new int[] { 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0xAB, 0xBA, 0xEA, 0xFB },\n                new int[] { 0x54, 0x55, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA, 0xE9, 0xEA, 0xFA },\n                new int[] { 0x54, 0x55, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA },\n                new int[] { 0x55, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA },\n                new int[] { 0x55, 0x56, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xBA, 0xEA },\n                new int[] { 0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE, 0xB9, 0xBA, 0xE9, 0xEA, 0xFE },\n                new int[] { 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xAE, 0xBA, 0xEA, 0xFE },\n                new int[] { 0x55, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xBA, 0xEA },\n                new int[] { 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xBA, 0xEA },\n        };\n        LatticeVertex4D[] latticeVerticesByCode = new LatticeVertex4D[256];\n        for (int i = 0; i < 256; i++) {\n            int cx = ((i >> 0) & 3) - 1;\n            int cy = ((i >> 2) & 3) - 1;\n            int cz = ((i >> 4) & 3) - 1;\n            int cw = ((i >> 6) & 3) - 1;\n            latticeVerticesByCode[i] = new LatticeVertex4D(cx, cy, cz, cw);\n        }\n        int nLatticeVerticesTotal = 0;\n        for (int i = 0; i < 256; i++) {\n            nLatticeVerticesTotal += lookup4DVertexCodes[i].length;\n        }\n        LOOKUP_4D_A = new int[256];\n        LOOKUP_4D_B = new LatticeVertex4D[nLatticeVerticesTotal];\n        for (int i = 0, j = 0; i < 256; i++) {\n            LOOKUP_4D_A[i] = j | ((j + lookup4DVertexCodes[i].length) << 16);\n            for (int k = 0; k < lookup4DVertexCodes[i].length; k++) {\n                LOOKUP_4D_B[j++] = latticeVerticesByCode[lookup4DVertexCodes[i][k]];\n            }\n        }\n    }\n\n    private static class LatticeVertex4D {\n        public final float dx, dy, dz, dw;\n        public final long xsvp, ysvp, zsvp, wsvp;\n        public LatticeVertex4D(int xsv, int ysv, int zsv, int wsv) {\n            this.xsvp = xsv * PRIME_X; this.ysvp = ysv * PRIME_Y;\n            this.zsvp = zsv * PRIME_Z; this.wsvp = wsv * PRIME_W;\n            float ssv = (xsv + ysv + zsv + wsv) * UNSKEW_4D;\n            this.dx = -xsv - ssv;\n            this.dy = -ysv - ssv;\n            this.dz = -zsv - ssv;\n            this.dw = -wsv - ssv;\n        }\n    }\n}\n"
  },
  {
    "path": "rust/OpenSimplex2.h",
    "content": "#pragma once\n#ifndef OPENSIMPLEX2_H\n\nextern float opensimplex2_fast_noise2(long long seed, double x, double y);\nextern float opensimplex2_fast_noise2_ImproveX(long long seed, double x, double y);\nextern float opensimplex2_fast_noise3_ImproveXY(long long seed, double x, double y, double z);\nextern float opensimplex2_fast_noise3_ImproveXZ(long long seed, double x, double y, double z);\nextern float opensimplex2_fast_noise3_Fallback(long long seed, double x, double y, double z);\nextern float opensimplex2_fast_noise4_ImproveXYZ_ImproveXY(long long seed, double x, double y, double z, double w);\nextern float opensimplex2_fast_noise4_ImproveXYZ_ImproveXZ(long long seed, double x, double y, double z, double w);\nextern float opensimplex2_fast_noise4_ImproveXYZ(long long seed, double x, double y, double z, double w);\nextern float opensimplex2_fast_noise4_ImproveXY_ImproveZW(long long seed, double x, double y, double z, double w);\nextern float opensimplex2_fast_noise4_Fallback(long long seed, double x, double y, double z, double w);\nextern float opensimplex2_smooth_noise2(long long seed, double x, double y);\nextern float opensimplex2_smooth_noise2_ImproveX(long long seed, double x, double y);\nextern float opensimplex2_smooth_noise3_ImproveXY(long long seed, double x, double y, double z);\nextern float opensimplex2_smooth_noise3_ImproveXZ(long long seed, double x, double y, double z);\nextern float opensimplex2_smooth_noise3_Fallback(long long seed, double x, double y, double z);\nextern float opensimplex2_smooth_noise4_ImproveXYZ_ImproveXY(long long seed, double x, double y, double z, double w);\nextern float opensimplex2_smooth_noise4_ImproveXYZ_ImproveXZ(long long seed, double x, double y, double z, double w);\nextern float opensimplex2_smooth_noise4_ImproveXYZ(long long seed, double x, double y, double z, double w);\nextern float opensimplex2_smooth_noise4_ImproveXY_ImproveZW(long long seed, double x, double y, double z, double w);\nextern float opensimplex2_smooth_noise4_Fallback(long long seed, double x, double y, double z, double w);\n\n#endif\n"
  },
  {
    "path": "rust/fast.rs",
    "content": "/*!\n    K.jpg's OpenSimplex 2, faster variant\n*/\n\nuse std::{num::Wrapping, sync::Once};\n\nconst PRIME_X: i64 = 0x5205402B9270C86F;\nconst PRIME_Y: i64 = 0x598CD327003817B5;\nconst PRIME_Z: i64 = 0x5BCC226E9FA0BACB;\nconst PRIME_W: i64 = 0x56CC5227E58F554B;\nconst HASH_MULTIPLIER: i64 = 0x53A3F72DEEC546F5;\nconst SEED_FLIP_3D: i64 = -0x52D547B2E96ED629;\nconst SEED_OFFSET_4D: i64 = 0xE83DC3E0DA7164D;\n\nconst ROOT2OVER2: f64 = 0.7071067811865476;\nconst SKEW_2D: f64 = 0.366025403784439;\nconst UNSKEW_2D: f64 = -0.21132486540518713;\n\nconst ROOT3OVER3: f64 = 0.577350269189626;\nconst FALLBACK_ROTATE_3D: f64 = 2.0 / 3.0;\nconst ROTATE_3D_ORTHOGONALIZER: f64 = UNSKEW_2D;\n\nconst SKEW_4D: f32 = -0.138196601125011;\nconst UNSKEW_4D: f32 = 0.309016994374947;\nconst LATTICE_STEP_4D: f32 = 0.2;\n\nconst N_GRADS_2D_EXPONENT: i32 = 7;\nconst N_GRADS_3D_EXPONENT: i32 = 8;\nconst N_GRADS_4D_EXPONENT: i32 = 9;\nconst N_GRADS_2D: i32 = 1 << N_GRADS_2D_EXPONENT;\nconst N_GRADS_3D: i32 = 1 << N_GRADS_3D_EXPONENT;\nconst N_GRADS_4D: i32 = 1 << N_GRADS_4D_EXPONENT;\n\nconst NORMALIZER_2D: f64 = 0.01001634121365712;\nconst NORMALIZER_3D: f64 = 0.07969837668935331;\nconst NORMALIZER_4D: f64 = 0.0220065933241897;\n\nconst RSQUARED_2D: f32 = 0.5;\nconst RSQUARED_3D: f32 = 0.6;\nconst RSQUARED_4D: f32 = 0.6;\n\n/*\n    Noise Evaluators\n*/\n\n/**\n    2D Simplex noise, standard lattice orientation.\n*/\npub fn noise2(seed: i64, x: f64, y: f64) -> f32 {\n    // Get points for A2* lattice\n    let s = SKEW_2D * (x + y);\n    let xs = x + s;\n    let ys = y + s;\n\n    noise2_UnskewedBase(seed, xs, ys)\n}\n\n/**\n    2D Simplex noise, with Y pointing down the main diagonal.\n    Might be better for a 2D sandbox style game, where Y is vertical.\n    Probably slightly less optimal for heightmaps or continent maps,\n    unless your map is centered around an equator. It's a subtle\n    difference, but the option is here to make it an easy choice.\n*/\npub fn noise2_ImproveX(seed: i64, x: f64, y: f64) -> f32 {\n    // Skew transform and rotation baked into one.\n    let xx = x * ROOT2OVER2;\n    let yy = y * (ROOT2OVER2 * (1.0 + 2.0 * SKEW_2D));\n\n    noise2_UnskewedBase(seed, yy + xx, yy - xx)\n}\n\n/**\n    2D Simplex noise base.\n*/\nfn noise2_UnskewedBase(seed: i64, xs: f64, ys: f64) -> f32 {\n    let seed = Wrapping(seed);\n\n    // Get base points and offsets.\n    let xsb = fastFloor(xs);\n    let ysb = fastFloor(ys);\n    let xi = (xs - xsb as f64) as f32;\n    let yi = (ys - ysb as f64) as f32;\n\n    // Prime pre-multiplication for hash.\n    let xsbp = Wrapping(xsb as i64) * Wrapping(PRIME_X);\n    let ysbp = Wrapping(ysb as i64) * Wrapping(PRIME_Y);\n\n    // Unskew.\n    let t = (xi + yi) * UNSKEW_2D as f32;\n    let dx0 = xi + t;\n    let dy0 = yi + t;\n\n    // First vertex.\n    let mut value = 0.0;\n    let a0 = RSQUARED_2D - dx0 * dx0 - dy0 * dy0;\n    if a0 > 0.0 {\n        value = (a0 * a0) * (a0 * a0) * grad2(seed, xsbp, ysbp, dx0, dy0);\n    }\n\n    // Second vertex.\n    let a1 = (2.0 * (1.0 + 2.0 * UNSKEW_2D) * (1.0 / UNSKEW_2D + 2.0)) as f32 * t\n        + ((-2.0 * (1.0 + 2.0 * UNSKEW_2D) * (1.0 + 2.0 * UNSKEW_2D)) as f32 + a0);\n    if a1 > 0.0 {\n        let dx1 = dx0 - (1.0 + 2.0 * UNSKEW_2D) as f32;\n        let dy1 = dy0 - (1.0 + 2.0 * UNSKEW_2D) as f32;\n        value += (a1 * a1)\n            * (a1 * a1)\n            * grad2(\n                seed,\n                xsbp + Wrapping(PRIME_X),\n                ysbp + Wrapping(PRIME_Y),\n                dx1,\n                dy1,\n            );\n    }\n\n    // Third vertex.\n    if dy0 > dx0 {\n        let dx2 = dx0 - UNSKEW_2D as f32;\n        let dy2 = dy0 - (UNSKEW_2D + 1.0) as f32;\n        let a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n        if a2 > 0.0 {\n            value += (a2 * a2) * (a2 * a2) * grad2(seed, xsbp, ysbp + Wrapping(PRIME_Y), dx2, dy2);\n        }\n    } else {\n        let dx2 = dx0 - (UNSKEW_2D + 1.0) as f32;\n        let dy2 = dy0 - UNSKEW_2D as f32;\n        let a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n        if a2 > 0.0 {\n            value += (a2 * a2) * (a2 * a2) * grad2(seed, xsbp + Wrapping(PRIME_X), ysbp, dx2, dy2);\n        }\n    }\n\n    value\n}\n\n/**\n    3D OpenSimplex2 noise, with better visual isotropy in (X, Y).\n    Recommended for 3D terrain and time-varied animations.\n    The Z coordinate should always be the \"different\" coordinate in whatever your use case is.\n    If Y is vertical in world coordinates, call noise3_ImproveXZ(x, z, Y) or use noise3_XZBeforeY.\n    If Z is vertical in world coordinates, call noise3_ImproveXZ(x, y, Z).\n    For a time varied animation, call noise3_ImproveXY(x, y, T).\n*/\npub fn noise3_ImproveXY(seed: i64, x: f64, y: f64, z: f64) -> f32 {\n    // Re-orient the cubic lattices without skewing, so Z points up the main lattice diagonal,\n    // and the planes formed by XY are moved far out of alignment with the cube faces.\n    // Orthonormal rotation. Not a skew transform.\n    let xy = x + y;\n    let s2 = xy * ROTATE_3D_ORTHOGONALIZER;\n    let zz = z * ROOT3OVER3;\n    let xr = x + s2 + zz;\n    let yr = y + s2 + zz;\n    let zr = xy * -ROOT3OVER3 + zz;\n\n    // Evaluate both lattices to form a BCC lattice.\n    noise3_UnrotatedBase(seed, xr, yr, zr)\n}\n\n/**\n    3D OpenSimplex2 noise, with better visual isotropy in (X, Z).\n    Recommended for 3D terrain and time-varied animations.\n    The Y coordinate should always be the \"different\" coordinate in whatever your use case is.\n    If Y is vertical in world coordinates, call noise3_ImproveXZ(x, Y, z).\n    If Z is vertical in world coordinates, call noise3_ImproveXZ(x, Z, y) or use noise3_ImproveXY.\n    For a time varied animation, call noise3_ImproveXZ(x, T, y) or use noise3_ImproveXY.\n*/\npub fn noise3_ImproveXZ(seed: i64, x: f64, y: f64, z: f64) -> f32 {\n    // Re-orient the cubic lattices without skewing, so Y points up the main lattice diagonal,\n    // and the planes formed by XZ are moved far out of alignment with the cube faces.\n    // Orthonormal rotation. Not a skew transform.\n    let xz = x + z;\n    let s2 = xz * ROTATE_3D_ORTHOGONALIZER;\n    let yy = y * ROOT3OVER3;\n    let xr = x + s2 + yy;\n    let zr = z + s2 + yy;\n    let yr = xz * -ROOT3OVER3 + yy;\n\n    // Evaluate both lattices to form a BCC lattice.\n    noise3_UnrotatedBase(seed, xr, yr, zr)\n}\n\n/**\n    3D OpenSimplex2 noise, fallback rotation option\n    Use noise3_ImproveXY or noise3_ImproveXZ instead, wherever appropriate.\n    They have less diagonal bias. This function's best use is as a fallback.\n*/\npub fn noise3_Fallback(seed: i64, x: f64, y: f64, z: f64) -> f32 {\n    // Re-orient the cubic lattices via rotation, to produce a familiar look.\n    // Orthonormal rotation. Not a skew transform.\n    let r = FALLBACK_ROTATE_3D * (x + y + z);\n    let xr = r - x;\n    let yr = r - y;\n    let zr = r - z;\n\n    // Evaluate both lattices to form a BCC lattice.\n    noise3_UnrotatedBase(seed, xr, yr, zr)\n}\n\n/**\n    Generate overlapping cubic lattices for 3D OpenSimplex2 noise.\n*/\nfn noise3_UnrotatedBase(seed: i64, xr: f64, yr: f64, zr: f64) -> f32 {\n    let mut seed = Wrapping(seed);\n\n    // Get base points and offsets.\n    let xrb = fastRound(xr);\n    let yrb = fastRound(yr);\n    let zrb = fastRound(zr);\n    let mut xri = (xr - xrb as f64) as f32;\n    let mut yri = (yr - yrb as f64) as f32;\n    let mut zri = (zr - zrb as f64) as f32;\n\n    // -1 if positive, 1 if negative.\n    let mut xNSign = (-1.0 - xri) as i32 | 1;\n    let mut yNSign = (-1.0 - yri) as i32 | 1;\n    let mut zNSign = (-1.0 - zri) as i32 | 1;\n\n    // Compute absolute values, using the above as a shortcut. This was faster in my tests for some reason.\n    let mut ax0 = xNSign as f32 * -xri;\n    let mut ay0 = yNSign as f32 * -yri;\n    let mut az0 = zNSign as f32 * -zri;\n\n    // Prime pre-multiplication for hash.\n    let mut xrbp = Wrapping(xrb as i64) * Wrapping(PRIME_X);\n    let mut yrbp = Wrapping(yrb as i64) * Wrapping(PRIME_Y);\n    let mut zrbp = Wrapping(zrb as i64) * Wrapping(PRIME_Z);\n\n    // Loop: Pick an edge on each lattice copy.\n    let mut value = 0.0;\n    let mut a = (RSQUARED_3D - xri * xri) - (yri * yri + zri * zri);\n    for l in 0.. {\n        // Closest point on cube.\n        if a > 0.0 {\n            value += (a * a) * (a * a) * grad3(seed, xrbp, yrbp, zrbp, xri, yri, zri);\n        }\n\n        // Second-closest point.\n        if ax0 >= ay0 && ax0 >= az0 {\n            let mut b = a + ax0 + ax0;\n            if b > 1.0 {\n                b -= 1.0;\n                value += (b * b)\n                    * (b * b)\n                    * grad3(\n                        seed,\n                        xrbp - Wrapping(xNSign as i64) * Wrapping(PRIME_X),\n                        yrbp,\n                        zrbp,\n                        xri + xNSign as f32,\n                        yri,\n                        zri,\n                    );\n            }\n        } else if ay0 > ax0 && ay0 >= az0 {\n            let mut b = a + ay0 + ay0;\n            if b > 1.0 {\n                b -= 1.0;\n                value += (b * b)\n                    * (b * b)\n                    * grad3(\n                        seed,\n                        xrbp,\n                        yrbp - Wrapping(yNSign as i64) * Wrapping(PRIME_Y),\n                        zrbp,\n                        xri,\n                        yri + yNSign as f32,\n                        zri,\n                    );\n            }\n        } else {\n            let mut b = a + az0 + az0;\n            if b > 1.0 {\n                b -= 1.0;\n                value += (b * b)\n                    * (b * b)\n                    * grad3(\n                        seed,\n                        xrbp,\n                        yrbp,\n                        zrbp - Wrapping(zNSign as i64) * Wrapping(PRIME_Z),\n                        xri,\n                        yri,\n                        zri + zNSign as f32,\n                    );\n            }\n        }\n\n        // Break from loop if we're done, skipping updates below.\n        if l == 1 {\n            break;\n        }\n\n        // Update absolute value.\n        ax0 = 0.5 - ax0;\n        ay0 = 0.5 - ay0;\n        az0 = 0.5 - az0;\n\n        // Update relative coordinate.\n        xri = xNSign as f32 * ax0;\n        yri = yNSign as f32 * ay0;\n        zri = zNSign as f32 * az0;\n\n        // Update falloff.\n        a += (0.75 - ax0) - (ay0 + az0);\n\n        // Update prime for hash.\n        xrbp += (xNSign as i64 >> 1) & PRIME_X;\n        yrbp += (yNSign as i64 >> 1) & PRIME_Y;\n        zrbp += (zNSign as i64 >> 1) & PRIME_Z;\n\n        // Update the reverse sign indicators.\n        xNSign = -xNSign;\n        yNSign = -yNSign;\n        zNSign = -zNSign;\n\n        // And finally update the seed for the other lattice copy.\n        seed ^= SEED_FLIP_3D;\n    }\n\n    value\n}\n\n/**\n    4D OpenSimplex2 noise, with XYZ oriented like noise3_ImproveXY\n    and W for an extra degree of freedom. W repeats eventually.\n    Recommended for time-varied animations which texture a 3D object (W=time)\n    in a space where Z is vertical\n*/\npub fn noise4_ImproveXYZ_ImproveXY(seed: i64, x: f64, y: f64, z: f64, w: f64) -> f32 {\n    let xy = x + y;\n    let s2 = xy * -0.21132486540518699998;\n    let zz = z * 0.28867513459481294226;\n    let ww = w * 0.2236067977499788;\n    let xr = x + (zz + ww + s2);\n    let yr = y + (zz + ww + s2);\n    let zr = xy * -0.57735026918962599998 + (zz + ww);\n    let wr = z * -0.866025403784439 + ww;\n\n    noise4_UnskewedBase(seed, xr, yr, zr, wr)\n}\n\n/**\n    4D OpenSimplex2 noise, with XYZ oriented like noise3_ImproveXZ\n    and W for an extra degree of freedom. W repeats eventually.\n    Recommended for time-varied animations which texture a 3D object (W=time)\n    in a space where Y is vertical\n*/\npub fn noise4_ImproveXYZ_ImproveXZ(seed: i64, x: f64, y: f64, z: f64, w: f64) -> f32 {\n    let xz = x + z;\n    let s2 = xz * -0.21132486540518699998;\n    let yy = y * 0.28867513459481294226;\n    let ww = w * 0.2236067977499788;\n    let xr = x + (yy + ww + s2);\n    let zr = z + (yy + ww + s2);\n    let yr = xz * -0.57735026918962599998 + (yy + ww);\n    let wr = y * -0.866025403784439 + ww;\n\n    noise4_UnskewedBase(seed, xr, yr, zr, wr)\n}\n\n/**\n    4D OpenSimplex2 noise, with XYZ oriented like noise3_Fallback\n    and W for an extra degree of freedom. W repeats eventually.\n    Recommended for time-varied animations which texture a 3D object (W=time)\n    where there isn't a clear distinction between horizontal and vertical\n*/\npub fn noise4_ImproveXYZ(seed: i64, x: f64, y: f64, z: f64, w: f64) -> f32 {\n    let xyz = x + y + z;\n    let ww = w * 0.2236067977499788;\n    let s2 = xyz * -0.16666666666666666 + ww;\n    let xs = x + s2;\n    let ys = y + s2;\n    let zs = z + s2;\n    let ws = -0.5 * xyz + ww;\n\n    noise4_UnskewedBase(seed, xs, ys, zs, ws)\n}\n\n/**\n    4D OpenSimplex2 noise, with XY and ZW forming orthogonal triangular-based planes.\n    Recommended for 3D terrain, where X and Y (or Z and W) are horizontal.\n    Recommended for noise(x, y, sin(time), cos(time)) trick.\n*/\npub fn noise4_ImproveXY_ImproveZW(seed: i64, x: f64, y: f64, z: f64, w: f64) -> f32 {\n    let s2 = (x + y) * -0.178275657951399372 + (z + w) * 0.215623393288842828;\n    let t2 = (z + w) * -0.403949762580207112 + (x + y) * -0.375199083010075342;\n    let xs = x + s2;\n    let ys = y + s2;\n    let zs = z + t2;\n    let ws = w + t2;\n\n    noise4_UnskewedBase(seed, xs, ys, zs, ws)\n}\n\n/**\n    4D OpenSimplex2 noise, fallback lattice orientation.\n*/\npub fn noise4_Fallback(seed: i64, x: f64, y: f64, z: f64, w: f64) -> f32 {\n    // Get points for A4 lattice\n    let s = SKEW_4D as f64 * (x + y + z + w);\n    let xs = x + s;\n    let ys = y + s;\n    let zs = z + s;\n    let ws = w + s;\n\n    noise4_UnskewedBase(seed, xs, ys, zs, ws)\n}\n\n/**\n    4D OpenSimplex2 noise base.\n*/\nfn noise4_UnskewedBase(seed: i64, xs: f64, ys: f64, zs: f64, ws: f64) -> f32 {\n    let mut seed = Wrapping(seed);\n\n    // Get base points and offsets\n    let xsb = fastFloor(xs);\n    let ysb = fastFloor(ys);\n    let zsb = fastFloor(zs);\n    let wsb = fastFloor(ws);\n    let mut xsi = (xs - xsb as f64) as f32;\n    let mut ysi = (ys - ysb as f64) as f32;\n    let mut zsi = (zs - zsb as f64) as f32;\n    let mut wsi = (ws - wsb as f64) as f32;\n\n    // Determine which lattice we can be confident has a contributing point its corresponding cell's base simplex.\n    // We only look at the spaces between the diagonal planes. This proved effective in all of my tests.\n    let siSum = (xsi + ysi) + (zsi + wsi);\n    let startingLattice = (siSum * 1.25) as i32;\n\n    // Offset for seed based on first lattice copy.\n    seed += Wrapping(startingLattice as i64) * Wrapping(SEED_OFFSET_4D);\n\n    // Offset for lattice point relative positions (skewed)\n    let startingLatticeOffset = startingLattice as f32 * -LATTICE_STEP_4D;\n    xsi += startingLatticeOffset;\n    ysi += startingLatticeOffset;\n    zsi += startingLatticeOffset;\n    wsi += startingLatticeOffset;\n\n    // Prep for vertex contributions.\n    let mut ssi = (siSum + startingLatticeOffset * 4.0) * UNSKEW_4D;\n\n    // Prime pre-multiplication for hash.\n    let mut xsvp = Wrapping(xsb as i64) * Wrapping(PRIME_X);\n    let mut ysvp = Wrapping(ysb as i64) * Wrapping(PRIME_Y);\n    let mut zsvp = Wrapping(zsb as i64) * Wrapping(PRIME_Z);\n    let mut wsvp = Wrapping(wsb as i64) * Wrapping(PRIME_W);\n\n    // Five points to add, total, from five copies of the A4 lattice.\n    let mut value = 0.0;\n    for i in 0.. {\n        // Next point is the closest vertex on the 4-simplex whose base vertex is the aforementioned vertex.\n        let score0 = 1.0 + ssi * (-1.0 / UNSKEW_4D); // Seems slightly faster than 1.0-xsi-ysi-zsi-wsi\n        if xsi >= ysi && xsi >= zsi && xsi >= wsi && xsi >= score0 {\n            xsvp += PRIME_X;\n            xsi -= 1.0;\n            ssi -= UNSKEW_4D;\n        } else if ysi > xsi && ysi >= zsi && ysi >= wsi && ysi >= score0 {\n            ysvp += PRIME_Y;\n            ysi -= 1.0;\n            ssi -= UNSKEW_4D;\n        } else if zsi > xsi && zsi > ysi && zsi >= wsi && zsi >= score0 {\n            zsvp += PRIME_Z;\n            zsi -= 1.0;\n            ssi -= UNSKEW_4D;\n        } else if wsi > xsi && wsi > ysi && wsi > zsi && wsi >= score0 {\n            wsvp += PRIME_W;\n            wsi -= 1.0;\n            ssi -= UNSKEW_4D;\n        }\n\n        // gradient contribution with falloff.\n        let dx = xsi + ssi;\n        let dy = ysi + ssi;\n        let dz = zsi + ssi;\n        let dw = wsi + ssi;\n        let mut a = (dx * dx + dy * dy) + (dz * dz + dw * dw);\n        if a < RSQUARED_4D {\n            a -= RSQUARED_4D;\n            a *= a;\n            value += a * a * grad4(seed, xsvp, ysvp, zsvp, wsvp, dx, dy, dz, dw);\n        }\n\n        // Break from loop if we're done, skipping updates below.\n        if i == 4 {\n            break;\n        }\n\n        // Update for next lattice copy shifted down by <-0.2, -0.2, -0.2, -0.2>.\n        xsi += LATTICE_STEP_4D;\n        ysi += LATTICE_STEP_4D;\n        zsi += LATTICE_STEP_4D;\n        wsi += LATTICE_STEP_4D;\n        ssi += LATTICE_STEP_4D * 4.0 * UNSKEW_4D;\n        seed -= SEED_OFFSET_4D;\n\n        // Because we don't always start on the same lattice copy, there's a special reset case.\n        if i == startingLattice {\n            xsvp -= PRIME_X;\n            ysvp -= PRIME_Y;\n            zsvp -= PRIME_Z;\n            wsvp -= PRIME_W;\n            seed += SEED_OFFSET_4D * 5;\n        }\n    }\n\n    value\n}\n\n/*\n    Utility\n*/\n\nfn grad2(seed: Wrapping<i64>, xsvp: Wrapping<i64>, ysvp: Wrapping<i64>, dx: f32, dy: f32) -> f32 {\n    let mut hash = seed ^ xsvp ^ ysvp;\n    hash *= HASH_MULTIPLIER;\n    hash ^= hash.0 >> (64 - N_GRADS_2D_EXPONENT + 1);\n    let gi = (hash.0 as i32 & ((N_GRADS_2D - 1) << 1)) as usize;\n    let grads = &getGradients().gradients2D;\n    grads[gi | 0] * dx + grads[gi | 1] * dy\n}\n\nfn grad3(\n    seed: Wrapping<i64>,\n    xrvp: Wrapping<i64>,\n    yrvp: Wrapping<i64>,\n    zrvp: Wrapping<i64>,\n    dx: f32,\n    dy: f32,\n    dz: f32,\n) -> f32 {\n    let mut hash = (seed ^ xrvp) ^ (yrvp ^ zrvp);\n    hash *= HASH_MULTIPLIER;\n    hash ^= hash.0 >> (64 - N_GRADS_3D_EXPONENT + 2);\n    let gi = (hash.0 as i32 & ((N_GRADS_3D - 1) << 2)) as usize;\n    let grads = &getGradients().gradients3D;\n    grads[gi | 0] * dx + grads[gi | 1] * dy + grads[gi | 2] * dz\n}\n\nfn grad4(\n    seed: Wrapping<i64>,\n    xsvp: Wrapping<i64>,\n    ysvp: Wrapping<i64>,\n    zsvp: Wrapping<i64>,\n    wsvp: Wrapping<i64>,\n    dx: f32,\n    dy: f32,\n    dz: f32,\n    dw: f32,\n) -> f32 {\n    let mut hash = seed ^ (xsvp ^ ysvp) ^ (zsvp ^ wsvp);\n    hash *= HASH_MULTIPLIER;\n    hash ^= hash.0 >> (64 - N_GRADS_4D_EXPONENT + 2);\n    let gi = (hash.0 as i32 & ((N_GRADS_4D - 1) << 2)) as usize;\n    let grads = &getGradients().gradients4D;\n    (grads[gi | 0] * dx + grads[gi | 1] * dy) + (grads[gi | 2] * dz + grads[gi | 3] * dw)\n}\n\nfn fastFloor(x: f64) -> i32 {\n    let xi = x as i32;\n    if x < xi as f64 {\n        xi - 1\n    } else {\n        xi\n    }\n}\n\nfn fastRound(x: f64) -> i32 {\n    if x < 0.0 {\n        (x - 0.5) as i32\n    } else {\n        (x + 0.5) as i32\n    }\n}\n\n/*\n    gradients\n*/\n\nstruct Gradients {\n    gradients2D: Vec<f32>,\n    gradients3D: Vec<f32>,\n    gradients4D: Vec<f32>,\n}\n\nstatic mut GRADIENTS: (Once, Option<Gradients>) = (Once::new(), None);\n\nfn getGradients() -> &'static Gradients {\n    unsafe {\n        GRADIENTS.0.call_once(|| {\n            GRADIENTS.1 = Some(initGradients());\n        });\n        GRADIENTS.1.as_ref().unwrap()\n    }\n}\n\nfn initGradients() -> Gradients {\n    let gradients2D: Vec<_> = GRAD2_SRC\n        .into_iter()\n        .map(|v| (v / NORMALIZER_2D) as f32)\n        .collect::<Vec<_>>() // cache divisions\n        .into_iter()\n        .cycle()\n        .take((N_GRADS_2D * 2) as usize)\n        .collect();\n\n    let gradients3D: Vec<_> = GRAD3_SRC\n        .into_iter()\n        .map(|v| (v / NORMALIZER_3D) as f32)\n        .collect::<Vec<_>>() // cache divisions\n        .into_iter()\n        .cycle()\n        .take((N_GRADS_3D * 4) as usize)\n        .collect();\n\n    let gradients4D: Vec<_> = GRAD4_SRC\n        .into_iter()\n        .map(|v| (v / NORMALIZER_4D) as f32)\n        .collect::<Vec<_>>() // cache divisions\n        .into_iter()\n        .cycle()\n        .take((N_GRADS_4D * 4) as usize)\n        .collect();\n\n    Gradients {\n        gradients2D,\n        gradients3D,\n        gradients4D,\n    }\n}\n\n#[rustfmt::skip]\nconst GRAD2_SRC: &[f64] = &[\n     0.38268343236509,   0.923879532511287,\n     0.923879532511287,  0.38268343236509,\n     0.923879532511287, -0.38268343236509,\n     0.38268343236509,  -0.923879532511287,\n    -0.38268343236509,  -0.923879532511287,\n    -0.923879532511287, -0.38268343236509,\n    -0.923879532511287,  0.38268343236509,\n    -0.38268343236509,   0.923879532511287,\n    //-------------------------------------//\n     0.130526192220052,  0.99144486137381,\n     0.608761429008721,  0.793353340291235,\n     0.793353340291235,  0.608761429008721,\n     0.99144486137381,   0.130526192220051,\n     0.99144486137381,  -0.130526192220051,\n     0.793353340291235, -0.60876142900872,\n     0.608761429008721, -0.793353340291235,\n     0.130526192220052, -0.99144486137381,\n    -0.130526192220052, -0.99144486137381,\n    -0.608761429008721, -0.793353340291235,\n    -0.793353340291235, -0.608761429008721,\n    -0.99144486137381,  -0.130526192220052,\n    -0.99144486137381,   0.130526192220051,\n    -0.793353340291235,  0.608761429008721,\n    -0.608761429008721,  0.793353340291235,\n    -0.130526192220052,  0.99144486137381,\n];\n\n#[rustfmt::skip]\nconst GRAD3_SRC: &[f64] = &[\n     2.22474487139,       2.22474487139,      -1.0,                 0.0,\n     2.22474487139,       2.22474487139,       1.0,                 0.0,\n     3.0862664687972017,  1.1721513422464978,  0.0,                 0.0,\n     1.1721513422464978,  3.0862664687972017,  0.0,                 0.0,\n    -2.22474487139,       2.22474487139,      -1.0,                 0.0,\n    -2.22474487139,       2.22474487139,       1.0,                 0.0,\n    -1.1721513422464978,  3.0862664687972017,  0.0,                 0.0,\n    -3.0862664687972017,  1.1721513422464978,  0.0,                 0.0,\n    -1.0,                -2.22474487139,      -2.22474487139,       0.0,\n     1.0,                -2.22474487139,      -2.22474487139,       0.0,\n     0.0,                -3.0862664687972017, -1.1721513422464978,  0.0,\n     0.0,                -1.1721513422464978, -3.0862664687972017,  0.0,\n    -1.0,                -2.22474487139,       2.22474487139,       0.0,\n     1.0,                -2.22474487139,       2.22474487139,       0.0,\n     0.0,                -1.1721513422464978,  3.0862664687972017,  0.0,\n     0.0,                -3.0862664687972017,  1.1721513422464978,  0.0,\n    //--------------------------------------------------------------------//\n    -2.22474487139,      -2.22474487139,      -1.0,                 0.0,\n    -2.22474487139,      -2.22474487139,       1.0,                 0.0,\n    -3.0862664687972017, -1.1721513422464978,  0.0,                 0.0,\n    -1.1721513422464978, -3.0862664687972017,  0.0,                 0.0,\n    -2.22474487139,      -1.0,                -2.22474487139,       0.0,\n    -2.22474487139,       1.0,                -2.22474487139,       0.0,\n    -1.1721513422464978,  0.0,                -3.0862664687972017,  0.0,\n    -3.0862664687972017,  0.0,                -1.1721513422464978,  0.0,\n    -2.22474487139,      -1.0,                 2.22474487139,       0.0,\n    -2.22474487139,       1.0,                 2.22474487139,       0.0,\n    -3.0862664687972017,  0.0,                 1.1721513422464978,  0.0,\n    -1.1721513422464978,  0.0,                 3.0862664687972017,  0.0,\n    -1.0,                 2.22474487139,      -2.22474487139,       0.0,\n     1.0,                 2.22474487139,      -2.22474487139,       0.0,\n     0.0,                 1.1721513422464978, -3.0862664687972017,  0.0,\n     0.0,                 3.0862664687972017, -1.1721513422464978,  0.0,\n    -1.0,                 2.22474487139,       2.22474487139,       0.0,\n     1.0,                 2.22474487139,       2.22474487139,       0.0,\n     0.0,                 3.0862664687972017,  1.1721513422464978,  0.0,\n     0.0,                 1.1721513422464978,  3.0862664687972017,  0.0,\n     2.22474487139,      -2.22474487139,      -1.0,                 0.0,\n     2.22474487139,      -2.22474487139,       1.0,                 0.0,\n     1.1721513422464978, -3.0862664687972017,  0.0,                 0.0,\n     3.0862664687972017, -1.1721513422464978,  0.0,                 0.0,\n     2.22474487139,      -1.0,                -2.22474487139,       0.0,\n     2.22474487139,       1.0,                -2.22474487139,       0.0,\n     3.0862664687972017,  0.0,                -1.1721513422464978,  0.0,\n     1.1721513422464978,  0.0,                -3.0862664687972017,  0.0,\n     2.22474487139,      -1.0,                 2.22474487139,       0.0,\n     2.22474487139,       1.0,                 2.22474487139,       0.0,\n     1.1721513422464978,  0.0,                 3.0862664687972017,  0.0,\n     3.0862664687972017,  0.0,                 1.1721513422464978,  0.0,\n];\n\n#[rustfmt::skip]\nconst GRAD4_SRC: &[f64] = &[\n    -0.6740059517812944,   -0.3239847771997537,   -0.3239847771997537,    0.5794684678643381,\n    -0.7504883828755602,   -0.4004672082940195,    0.15296486218853164,   0.5029860367700724,\n    -0.7504883828755602,    0.15296486218853164,  -0.4004672082940195,    0.5029860367700724,\n    -0.8828161875373585,    0.08164729285680945,   0.08164729285680945,   0.4553054119602712,\n    -0.4553054119602712,   -0.08164729285680945,  -0.08164729285680945,   0.8828161875373585,\n    -0.5029860367700724,   -0.15296486218853164,   0.4004672082940195,    0.7504883828755602,\n    -0.5029860367700724,    0.4004672082940195,   -0.15296486218853164,   0.7504883828755602,\n    -0.5794684678643381,    0.3239847771997537,    0.3239847771997537,    0.6740059517812944,\n    -0.6740059517812944,   -0.3239847771997537,    0.5794684678643381,   -0.3239847771997537,\n    -0.7504883828755602,   -0.4004672082940195,    0.5029860367700724,    0.15296486218853164,\n    -0.7504883828755602,    0.15296486218853164,   0.5029860367700724,   -0.4004672082940195,\n    -0.8828161875373585,    0.08164729285680945,   0.4553054119602712,    0.08164729285680945,\n    -0.4553054119602712,   -0.08164729285680945,   0.8828161875373585,   -0.08164729285680945,\n    -0.5029860367700724,   -0.15296486218853164,   0.7504883828755602,    0.4004672082940195,\n    -0.5029860367700724,    0.4004672082940195,    0.7504883828755602,   -0.15296486218853164,\n    -0.5794684678643381,    0.3239847771997537,    0.6740059517812944,    0.3239847771997537,\n    -0.6740059517812944,    0.5794684678643381,   -0.3239847771997537,   -0.3239847771997537,\n    -0.7504883828755602,    0.5029860367700724,   -0.4004672082940195,    0.15296486218853164,\n    -0.7504883828755602,    0.5029860367700724,    0.15296486218853164,  -0.4004672082940195,\n    -0.8828161875373585,    0.4553054119602712,    0.08164729285680945,   0.08164729285680945,\n    -0.4553054119602712,    0.8828161875373585,   -0.08164729285680945,  -0.08164729285680945,\n    -0.5029860367700724,    0.7504883828755602,   -0.15296486218853164,   0.4004672082940195,\n    -0.5029860367700724,    0.7504883828755602,    0.4004672082940195,   -0.15296486218853164,\n    -0.5794684678643381,    0.6740059517812944,    0.3239847771997537,    0.3239847771997537,\n     0.5794684678643381,   -0.6740059517812944,   -0.3239847771997537,   -0.3239847771997537,\n     0.5029860367700724,   -0.7504883828755602,   -0.4004672082940195,    0.15296486218853164,\n     0.5029860367700724,   -0.7504883828755602,    0.15296486218853164,  -0.4004672082940195,\n     0.4553054119602712,   -0.8828161875373585,    0.08164729285680945,   0.08164729285680945,\n     0.8828161875373585,   -0.4553054119602712,   -0.08164729285680945,  -0.08164729285680945,\n     0.7504883828755602,   -0.5029860367700724,   -0.15296486218853164,   0.4004672082940195,\n     0.7504883828755602,   -0.5029860367700724,    0.4004672082940195,   -0.15296486218853164,\n     0.6740059517812944,   -0.5794684678643381,    0.3239847771997537,    0.3239847771997537,\n    //------------------------------------------------------------------------------------------//\n    -0.753341017856078,    -0.37968289875261624,  -0.37968289875261624,  -0.37968289875261624,\n    -0.7821684431180708,   -0.4321472685365301,   -0.4321472685365301,    0.12128480194602098,\n    -0.7821684431180708,   -0.4321472685365301,    0.12128480194602098,  -0.4321472685365301,\n    -0.7821684431180708,    0.12128480194602098,  -0.4321472685365301,   -0.4321472685365301,\n    -0.8586508742123365,   -0.508629699630796,     0.044802370851755174,  0.044802370851755174,\n    -0.8586508742123365,    0.044802370851755174, -0.508629699630796,     0.044802370851755174,\n    -0.8586508742123365,    0.044802370851755174,  0.044802370851755174, -0.508629699630796,\n    -0.9982828964265062,   -0.03381941603233842,  -0.03381941603233842,  -0.03381941603233842,\n    -0.37968289875261624,  -0.753341017856078,    -0.37968289875261624,  -0.37968289875261624,\n    -0.4321472685365301,   -0.7821684431180708,   -0.4321472685365301,    0.12128480194602098,\n    -0.4321472685365301,   -0.7821684431180708,    0.12128480194602098,  -0.4321472685365301,\n     0.12128480194602098,  -0.7821684431180708,   -0.4321472685365301,   -0.4321472685365301,\n    -0.508629699630796,    -0.8586508742123365,    0.044802370851755174,  0.044802370851755174,\n     0.044802370851755174, -0.8586508742123365,   -0.508629699630796,     0.044802370851755174,\n     0.044802370851755174, -0.8586508742123365,    0.044802370851755174, -0.508629699630796,\n    -0.03381941603233842,  -0.9982828964265062,   -0.03381941603233842,  -0.03381941603233842,\n    -0.37968289875261624,  -0.37968289875261624,  -0.753341017856078,    -0.37968289875261624,\n    -0.4321472685365301,   -0.4321472685365301,   -0.7821684431180708,    0.12128480194602098,\n    -0.4321472685365301,    0.12128480194602098,  -0.7821684431180708,   -0.4321472685365301,\n     0.12128480194602098,  -0.4321472685365301,   -0.7821684431180708,   -0.4321472685365301,\n    -0.508629699630796,     0.044802370851755174, -0.8586508742123365,    0.044802370851755174,\n     0.044802370851755174, -0.508629699630796,    -0.8586508742123365,    0.044802370851755174,\n     0.044802370851755174,  0.044802370851755174, -0.8586508742123365,   -0.508629699630796,\n    -0.03381941603233842,  -0.03381941603233842,  -0.9982828964265062,   -0.03381941603233842,\n    -0.37968289875261624,  -0.37968289875261624,  -0.37968289875261624,  -0.753341017856078,\n    -0.4321472685365301,   -0.4321472685365301,    0.12128480194602098,  -0.7821684431180708,\n    -0.4321472685365301,    0.12128480194602098,  -0.4321472685365301,   -0.7821684431180708,\n     0.12128480194602098,  -0.4321472685365301,   -0.4321472685365301,   -0.7821684431180708,\n    -0.508629699630796,     0.044802370851755174,  0.044802370851755174, -0.8586508742123365,\n     0.044802370851755174, -0.508629699630796,     0.044802370851755174, -0.8586508742123365,\n     0.044802370851755174,  0.044802370851755174, -0.508629699630796,    -0.8586508742123365,\n    -0.03381941603233842,  -0.03381941603233842,  -0.03381941603233842,  -0.9982828964265062,\n    -0.3239847771997537,   -0.6740059517812944,   -0.3239847771997537,    0.5794684678643381,\n    -0.4004672082940195,   -0.7504883828755602,    0.15296486218853164,   0.5029860367700724,\n     0.15296486218853164,  -0.7504883828755602,   -0.4004672082940195,    0.5029860367700724,\n     0.08164729285680945,  -0.8828161875373585,    0.08164729285680945,   0.4553054119602712,\n    -0.08164729285680945,  -0.4553054119602712,   -0.08164729285680945,   0.8828161875373585,\n    -0.15296486218853164,  -0.5029860367700724,    0.4004672082940195,    0.7504883828755602,\n     0.4004672082940195,   -0.5029860367700724,   -0.15296486218853164,   0.7504883828755602,\n     0.3239847771997537,   -0.5794684678643381,    0.3239847771997537,    0.6740059517812944,\n    -0.3239847771997537,   -0.3239847771997537,   -0.6740059517812944,    0.5794684678643381,\n    -0.4004672082940195,    0.15296486218853164,  -0.7504883828755602,    0.5029860367700724,\n     0.15296486218853164,  -0.4004672082940195,   -0.7504883828755602,    0.5029860367700724,\n     0.08164729285680945,   0.08164729285680945,  -0.8828161875373585,    0.4553054119602712,\n    -0.08164729285680945,  -0.08164729285680945,  -0.4553054119602712,    0.8828161875373585,\n    -0.15296486218853164,   0.4004672082940195,   -0.5029860367700724,    0.7504883828755602,\n     0.4004672082940195,   -0.15296486218853164,  -0.5029860367700724,    0.7504883828755602,\n     0.3239847771997537,    0.3239847771997537,   -0.5794684678643381,    0.6740059517812944,\n    -0.3239847771997537,   -0.6740059517812944,    0.5794684678643381,   -0.3239847771997537,\n    -0.4004672082940195,   -0.7504883828755602,    0.5029860367700724,    0.15296486218853164,\n     0.15296486218853164,  -0.7504883828755602,    0.5029860367700724,   -0.4004672082940195,\n     0.08164729285680945,  -0.8828161875373585,    0.4553054119602712,    0.08164729285680945,\n    -0.08164729285680945,  -0.4553054119602712,    0.8828161875373585,   -0.08164729285680945,\n    -0.15296486218853164,  -0.5029860367700724,    0.7504883828755602,    0.4004672082940195,\n     0.4004672082940195,   -0.5029860367700724,    0.7504883828755602,   -0.15296486218853164,\n     0.3239847771997537,   -0.5794684678643381,    0.6740059517812944,    0.3239847771997537,\n    -0.3239847771997537,   -0.3239847771997537,    0.5794684678643381,   -0.6740059517812944,\n    -0.4004672082940195,    0.15296486218853164,   0.5029860367700724,   -0.7504883828755602,\n     0.15296486218853164,  -0.4004672082940195,    0.5029860367700724,   -0.7504883828755602,\n     0.08164729285680945,   0.08164729285680945,   0.4553054119602712,   -0.8828161875373585,\n    -0.08164729285680945,  -0.08164729285680945,   0.8828161875373585,   -0.4553054119602712,\n    -0.15296486218853164,   0.4004672082940195,    0.7504883828755602,   -0.5029860367700724,\n     0.4004672082940195,   -0.15296486218853164,   0.7504883828755602,   -0.5029860367700724,\n     0.3239847771997537,    0.3239847771997537,    0.6740059517812944,   -0.5794684678643381,\n    -0.3239847771997537,    0.5794684678643381,   -0.6740059517812944,   -0.3239847771997537,\n    -0.4004672082940195,    0.5029860367700724,   -0.7504883828755602,    0.15296486218853164,\n     0.15296486218853164,   0.5029860367700724,   -0.7504883828755602,   -0.4004672082940195,\n     0.08164729285680945,   0.4553054119602712,   -0.8828161875373585,    0.08164729285680945,\n    -0.08164729285680945,   0.8828161875373585,   -0.4553054119602712,   -0.08164729285680945,\n    -0.15296486218853164,   0.7504883828755602,   -0.5029860367700724,    0.4004672082940195,\n     0.4004672082940195,    0.7504883828755602,   -0.5029860367700724,   -0.15296486218853164,\n     0.3239847771997537,    0.6740059517812944,   -0.5794684678643381,    0.3239847771997537,\n    -0.3239847771997537,    0.5794684678643381,   -0.3239847771997537,   -0.6740059517812944,\n    -0.4004672082940195,    0.5029860367700724,    0.15296486218853164,  -0.7504883828755602,\n     0.15296486218853164,   0.5029860367700724,   -0.4004672082940195,   -0.7504883828755602,\n     0.08164729285680945,   0.4553054119602712,    0.08164729285680945,  -0.8828161875373585,\n    -0.08164729285680945,   0.8828161875373585,   -0.08164729285680945,  -0.4553054119602712,\n    -0.15296486218853164,   0.7504883828755602,    0.4004672082940195,   -0.5029860367700724,\n     0.4004672082940195,    0.7504883828755602,   -0.15296486218853164,  -0.5029860367700724,\n     0.3239847771997537,    0.6740059517812944,    0.3239847771997537,   -0.5794684678643381,\n     0.5794684678643381,   -0.3239847771997537,   -0.6740059517812944,   -0.3239847771997537,\n     0.5029860367700724,   -0.4004672082940195,   -0.7504883828755602,    0.15296486218853164,\n     0.5029860367700724,    0.15296486218853164,  -0.7504883828755602,   -0.4004672082940195,\n     0.4553054119602712,    0.08164729285680945,  -0.8828161875373585,    0.08164729285680945,\n     0.8828161875373585,   -0.08164729285680945,  -0.4553054119602712,   -0.08164729285680945,\n     0.7504883828755602,   -0.15296486218853164,  -0.5029860367700724,    0.4004672082940195,\n     0.7504883828755602,    0.4004672082940195,   -0.5029860367700724,   -0.15296486218853164,\n     0.6740059517812944,    0.3239847771997537,   -0.5794684678643381,    0.3239847771997537,\n     0.5794684678643381,   -0.3239847771997537,   -0.3239847771997537,   -0.6740059517812944,\n     0.5029860367700724,   -0.4004672082940195,    0.15296486218853164,  -0.7504883828755602,\n     0.5029860367700724,    0.15296486218853164,  -0.4004672082940195,   -0.7504883828755602,\n     0.4553054119602712,    0.08164729285680945,   0.08164729285680945,  -0.8828161875373585,\n     0.8828161875373585,   -0.08164729285680945,  -0.08164729285680945,  -0.4553054119602712,\n     0.7504883828755602,   -0.15296486218853164,   0.4004672082940195,   -0.5029860367700724,\n     0.7504883828755602,    0.4004672082940195,   -0.15296486218853164,  -0.5029860367700724,\n     0.6740059517812944,    0.3239847771997537,    0.3239847771997537,   -0.5794684678643381,\n     0.03381941603233842,   0.03381941603233842,   0.03381941603233842,   0.9982828964265062,\n    -0.044802370851755174, -0.044802370851755174,  0.508629699630796,     0.8586508742123365,\n    -0.044802370851755174,  0.508629699630796,    -0.044802370851755174,  0.8586508742123365,\n    -0.12128480194602098,   0.4321472685365301,    0.4321472685365301,    0.7821684431180708,\n     0.508629699630796,    -0.044802370851755174, -0.044802370851755174,  0.8586508742123365,\n     0.4321472685365301,   -0.12128480194602098,   0.4321472685365301,    0.7821684431180708,\n     0.4321472685365301,    0.4321472685365301,   -0.12128480194602098,   0.7821684431180708,\n     0.37968289875261624,   0.37968289875261624,   0.37968289875261624,   0.753341017856078,\n     0.03381941603233842,   0.03381941603233842,   0.9982828964265062,    0.03381941603233842,\n    -0.044802370851755174,  0.044802370851755174,  0.8586508742123365,    0.508629699630796,\n    -0.044802370851755174,  0.508629699630796,     0.8586508742123365,   -0.044802370851755174,\n    -0.12128480194602098,   0.4321472685365301,    0.7821684431180708,    0.4321472685365301,\n     0.508629699630796,    -0.044802370851755174,  0.8586508742123365,   -0.044802370851755174,\n     0.4321472685365301,   -0.12128480194602098,   0.7821684431180708,    0.4321472685365301,\n     0.4321472685365301,    0.4321472685365301,    0.7821684431180708,   -0.12128480194602098,\n     0.37968289875261624,   0.37968289875261624,   0.753341017856078,     0.37968289875261624,\n     0.03381941603233842,   0.9982828964265062,    0.03381941603233842,   0.03381941603233842,\n    -0.044802370851755174,  0.8586508742123365,   -0.044802370851755174,  0.508629699630796,\n    -0.044802370851755174,  0.8586508742123365,    0.508629699630796,    -0.044802370851755174,\n    -0.12128480194602098,   0.7821684431180708,    0.4321472685365301,    0.4321472685365301,\n     0.508629699630796,     0.8586508742123365,   -0.044802370851755174, -0.044802370851755174,\n     0.4321472685365301,    0.7821684431180708,   -0.12128480194602098,   0.4321472685365301,\n     0.4321472685365301,    0.7821684431180708,    0.4321472685365301,   -0.12128480194602098,\n     0.37968289875261624,   0.753341017856078,     0.37968289875261624,   0.37968289875261624,\n     0.9982828964265062,    0.03381941603233842,   0.03381941603233842,   0.03381941603233842,\n     0.8586508742123365,   -0.044802370851755174, -0.044802370851755174,  0.508629699630796,\n     0.8586508742123365,   -0.044802370851755174,  0.508629699630796,    -0.044802370851755174,\n     0.7821684431180708,   -0.12128480194602098,   0.4321472685365301,    0.4321472685365301,\n     0.8586508742123365,    0.508629699630796,    -0.044802370851755174, -0.044802370851755174,\n     0.7821684431180708,    0.4321472685365301,   -0.12128480194602098,   0.4321472685365301,\n     0.7821684431180708,    0.4321472685365301,    0.4321472685365301,   -0.12128480194602098,\n     0.753341017856078,     0.37968289875261624,   0.37968289875261624,   0.37968289875261624,\n];\n"
  },
  {
    "path": "rust/ffi.rs",
    "content": "use std::ffi::{c_double, c_float, c_longlong};\n\nuse crate::{fast, smooth};\n\n#[no_mangle]\npub extern \"C\" fn opensimplex2_fast_noise2(seed: c_longlong, x: c_double, y: c_double) -> c_float {\n    fast::noise2(seed, x, y)\n}\n\n#[no_mangle]\npub extern \"C\" fn opensimplex2_fast_noise2_ImproveX(\n    seed: c_longlong,\n    x: c_double,\n    y: c_double,\n) -> c_float {\n    fast::noise2_ImproveX(seed, x, y)\n}\n\n#[no_mangle]\npub extern \"C\" fn opensimplex2_fast_noise3_ImproveXY(\n    seed: c_longlong,\n    x: c_double,\n    y: c_double,\n    z: c_double,\n) -> c_float {\n    fast::noise3_ImproveXY(seed, x, y, z)\n}\n\n#[no_mangle]\npub extern \"C\" fn opensimplex2_fast_noise3_ImproveXZ(\n    seed: c_longlong,\n    x: c_double,\n    y: c_double,\n    z: c_double,\n) -> c_float {\n    fast::noise3_ImproveXZ(seed, x, y, z)\n}\n\n#[no_mangle]\npub extern \"C\" fn opensimplex2_fast_noise3_Fallback(\n    seed: c_longlong,\n    x: c_double,\n    y: c_double,\n    z: c_double,\n) -> c_float {\n    fast::noise3_Fallback(seed, x, y, z)\n}\n\n#[no_mangle]\npub extern \"C\" fn opensimplex2_fast_noise4_ImproveXYZ_ImproveXY(\n    seed: c_longlong,\n    x: c_double,\n    y: c_double,\n    z: c_double,\n    w: c_double,\n) -> c_float {\n    fast::noise4_ImproveXYZ_ImproveXY(seed, x, y, z, w)\n}\n\n#[no_mangle]\npub extern \"C\" fn opensimplex2_fast_noise4_ImproveXYZ_ImproveXZ(\n    seed: c_longlong,\n    x: c_double,\n    y: c_double,\n    z: c_double,\n    w: c_double,\n) -> c_float {\n    fast::noise4_ImproveXYZ_ImproveXZ(seed, x, y, z, w)\n}\n\n#[no_mangle]\npub extern \"C\" fn opensimplex2_fast_noise4_ImproveXYZ(\n    seed: c_longlong,\n    x: c_double,\n    y: c_double,\n    z: c_double,\n    w: c_double,\n) -> c_float {\n    fast::noise4_ImproveXYZ(seed, x, y, z, w)\n}\n\n#[no_mangle]\npub extern \"C\" fn opensimplex2_fast_noise4_ImproveXY_ImproveZW(\n    seed: c_longlong,\n    x: c_double,\n    y: c_double,\n    z: c_double,\n    w: c_double,\n) -> c_float {\n    fast::noise4_ImproveXY_ImproveZW(seed, x, y, z, w)\n}\n\n#[no_mangle]\npub extern \"C\" fn opensimplex2_fast_noise4_Fallback(\n    seed: c_longlong,\n    x: c_double,\n    y: c_double,\n    z: c_double,\n    w: c_double,\n) -> c_float {\n    fast::noise4_Fallback(seed, x, y, z, w)\n}\n\n#[no_mangle]\npub extern \"C\" fn opensimplex2_smooth_noise2(\n    seed: c_longlong,\n    x: c_double,\n    y: c_double,\n) -> c_float {\n    smooth::noise2(seed, x, y)\n}\n\n#[no_mangle]\npub extern \"C\" fn opensimplex2_smooth_noise2_ImproveX(\n    seed: c_longlong,\n    x: c_double,\n    y: c_double,\n) -> c_float {\n    smooth::noise2_ImproveX(seed, x, y)\n}\n\n#[no_mangle]\npub extern \"C\" fn opensimplex2_smooth_noise3_ImproveXY(\n    seed: c_longlong,\n    x: c_double,\n    y: c_double,\n    z: c_double,\n) -> c_float {\n    smooth::noise3_ImproveXY(seed, x, y, z)\n}\n\n#[no_mangle]\npub extern \"C\" fn opensimplex2_smooth_noise3_ImproveXZ(\n    seed: c_longlong,\n    x: c_double,\n    y: c_double,\n    z: c_double,\n) -> c_float {\n    smooth::noise3_ImproveXZ(seed, x, y, z)\n}\n\n#[no_mangle]\npub extern \"C\" fn opensimplex2_smooth_noise3_Fallback(\n    seed: c_longlong,\n    x: c_double,\n    y: c_double,\n    z: c_double,\n) -> c_float {\n    smooth::noise3_Fallback(seed, x, y, z)\n}\n\n#[no_mangle]\npub extern \"C\" fn opensimplex2_smooth_noise4_ImproveXYZ_ImproveXY(\n    seed: c_longlong,\n    x: c_double,\n    y: c_double,\n    z: c_double,\n    w: c_double,\n) -> c_float {\n    smooth::noise4_ImproveXYZ_ImproveXY(seed, x, y, z, w)\n}\n\n#[no_mangle]\npub extern \"C\" fn opensimplex2_smooth_noise4_ImproveXYZ_ImproveXZ(\n    seed: c_longlong,\n    x: c_double,\n    y: c_double,\n    z: c_double,\n    w: c_double,\n) -> c_float {\n    smooth::noise4_ImproveXYZ_ImproveXZ(seed, x, y, z, w)\n}\n\n#[no_mangle]\npub extern \"C\" fn opensimplex2_smooth_noise4_ImproveXYZ(\n    seed: c_longlong,\n    x: c_double,\n    y: c_double,\n    z: c_double,\n    w: c_double,\n) -> c_float {\n    smooth::noise4_ImproveXYZ(seed, x, y, z, w)\n}\n\n#[no_mangle]\npub extern \"C\" fn opensimplex2_smooth_noise4_ImproveXY_ImproveZW(\n    seed: c_longlong,\n    x: c_double,\n    y: c_double,\n    z: c_double,\n    w: c_double,\n) -> c_float {\n    smooth::noise4_ImproveXY_ImproveZW(seed, x, y, z, w)\n}\n\n#[no_mangle]\npub extern \"C\" fn opensimplex2_smooth_noise4_Fallback(\n    seed: c_longlong,\n    x: c_double,\n    y: c_double,\n    z: c_double,\n    w: c_double,\n) -> c_float {\n    smooth::noise4_Fallback(seed, x, y, z, w)\n}\n"
  },
  {
    "path": "rust/lib.rs",
    "content": "#![allow(non_snake_case)]\n\npub mod fast;\nmod ffi;\npub mod smooth;\n"
  },
  {
    "path": "rust/smooth.rs",
    "content": "/*!\n    K.jpg's OpenSimplex 2, smooth variant (\"SuperSimplex\")\n*/\n\nuse std::{num::Wrapping, sync::Once};\n\nconst PRIME_X: i64 = 0x5205402B9270C86F;\nconst PRIME_Y: i64 = 0x598CD327003817B5;\nconst PRIME_Z: i64 = 0x5BCC226E9FA0BACB;\nconst PRIME_W: i64 = 0x56CC5227E58F554B;\nconst HASH_MULTIPLIER: i64 = 0x53A3F72DEEC546F5;\nconst SEED_FLIP_3D: i64 = -0x52D547B2E96ED629;\n\nconst ROOT2OVER2: f64 = 0.7071067811865476;\nconst SKEW_2D: f64 = 0.366025403784439;\nconst UNSKEW_2D: f64 = -0.21132486540518713;\n\nconst ROOT3OVER3: f64 = 0.577350269189626;\nconst FALLBACK_ROTATE3: f64 = 2.0 / 3.0;\nconst ROTATE3_ORTHOGONALIZER: f64 = UNSKEW_2D;\n\nconst SKEW_4D: f32 = 0.309016994374947;\nconst UNSKEW_4D: f32 = -0.138196601125011;\n\nconst N_GRADS_2D_EXPONENT: i32 = 7;\nconst N_GRADS_3D_EXPONENT: i32 = 8;\nconst N_GRADS_4D_EXPONENT: i32 = 9;\nconst N_GRADS_2D: i32 = 1 << N_GRADS_2D_EXPONENT;\nconst N_GRADS_3D: i32 = 1 << N_GRADS_3D_EXPONENT;\nconst N_GRADS_4D: i32 = 1 << N_GRADS_4D_EXPONENT;\n\nconst NORMALIZER_2D: f64 = 0.05481866495625118;\nconst NORMALIZER_3D: f64 = 0.2781926117527186;\nconst NORMALIZER_4D: f64 = 0.11127401889945551;\n\nconst RSQUARED_2D: f32 = 2.0 / 3.0;\nconst RSQUARED_3D: f32 = 3.0 / 4.0;\nconst RSQUARED_4D: f32 = 4.0 / 5.0;\n\n/*\n    Noise Evaluators\n*/\n\n/**\n    2D OpenSimplex2S/SuperSimplex noise, standard lattice orientation.\n*/\npub fn noise2(seed: i64, x: f64, y: f64) -> f32 {\n    // Get points for A2* lattice\n    let s = SKEW_2D * (x + y);\n    let xs = x + s;\n    let ys = y + s;\n\n    noise2_UnskewedBase(seed, xs, ys)\n}\n\n/**\n    2D OpenSimplex2S/SuperSimplex noise, with Y pointing down the main diagonal.\n    Might be better for a 2D sandbox style game, where Y is vertical.\n    Probably slightly less optimal for heightmaps or continent maps,\n    unless your map is centered around an equator. It's a slight\n    difference, but the option is here to make it easy.\n*/\npub fn noise2_ImproveX(seed: i64, x: f64, y: f64) -> f32 {\n    // Skew transform and rotation baked into one.\n    let xx = x * ROOT2OVER2;\n    let yy = y * (ROOT2OVER2 * (1.0 + 2.0 * SKEW_2D));\n\n    noise2_UnskewedBase(seed, yy + xx, yy - xx)\n}\n\n/**\n    2D  OpenSimplex2S/SuperSimplex noise base.\n*/\nfn noise2_UnskewedBase(seed: i64, xs: f64, ys: f64) -> f32 {\n    let seed = Wrapping(seed);\n\n    // Get base points and offsets.\n    let xsb = fastFloor(xs);\n    let ysb = fastFloor(ys);\n    let xi = (xs - xsb as f64) as f32;\n    let yi = (ys - ysb as f64) as f32;\n\n    // Prime pre-multiplication for hash.\n    let xsbp = Wrapping(xsb as i64) * Wrapping(PRIME_X);\n    let ysbp = Wrapping(ysb as i64) * Wrapping(PRIME_Y);\n\n    // Unskew.\n    let t = (xi + yi) * UNSKEW_2D as f32;\n    let dx0 = xi + t;\n    let dy0 = yi + t;\n\n    // First vertex.\n    let a0 = RSQUARED_2D - dx0 * dx0 - dy0 * dy0;\n    let mut value = (a0 * a0) * (a0 * a0) * grad2(seed, xsbp, ysbp, dx0, dy0);\n\n    // Second vertex.\n    let a1 = (2.0 * (1.0 + 2.0 * UNSKEW_2D) * (1.0 / UNSKEW_2D + 2.0)) as f32 * t\n        + ((-2.0 * (1.0 + 2.0 * UNSKEW_2D) * (1.0 + 2.0 * UNSKEW_2D)) as f32 + a0);\n    let dx1 = dx0 - (1.0 + 2.0 * UNSKEW_2D) as f32;\n    let dy1 = dy0 - (1.0 + 2.0 * UNSKEW_2D) as f32;\n    value += (a1 * a1)\n        * (a1 * a1)\n        * grad2(\n            seed,\n            xsbp + Wrapping(PRIME_X),\n            ysbp + Wrapping(PRIME_Y),\n            dx1,\n            dy1,\n        );\n\n    // Third and fourth vertices.\n    // Nested conditionals were faster than compact bit logic/arithmetic.\n    let xmyi = xi - yi;\n    if t < UNSKEW_2D as f32 {\n        if xi + xmyi > 1.0 {\n            let dx2 = dx0 - (3.0 * UNSKEW_2D + 2.0) as f32;\n            let dy2 = dy0 - (3.0 * UNSKEW_2D + 1.0) as f32;\n            let a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n            if a2 > 0.0 {\n                value += (a2 * a2)\n                    * (a2 * a2)\n                    * grad2(\n                        seed,\n                        xsbp + Wrapping(PRIME_X << 1),\n                        ysbp + Wrapping(PRIME_Y),\n                        dx2,\n                        dy2,\n                    );\n            }\n        } else {\n            let dx2 = dx0 - UNSKEW_2D as f32;\n            let dy2 = dy0 - (UNSKEW_2D + 1.0) as f32;\n            let a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n            if a2 > 0.0 {\n                value +=\n                    (a2 * a2) * (a2 * a2) * grad2(seed, xsbp, ysbp + Wrapping(PRIME_Y), dx2, dy2);\n            }\n        }\n\n        if yi - xmyi > 1.0 {\n            let dx3 = dx0 - (3.0 * UNSKEW_2D + 1.0) as f32;\n            let dy3 = dy0 - (3.0 * UNSKEW_2D + 2.0) as f32;\n            let a3 = RSQUARED_2D - dx3 * dx3 - dy3 * dy3;\n            if a3 > 0.0 {\n                value += (a3 * a3)\n                    * (a3 * a3)\n                    * grad2(\n                        seed,\n                        xsbp + Wrapping(PRIME_X),\n                        ysbp + Wrapping(PRIME_Y << 1),\n                        dx3,\n                        dy3,\n                    );\n            }\n        } else {\n            let dx3 = dx0 - (UNSKEW_2D + 1.0) as f32;\n            let dy3 = dy0 - UNSKEW_2D as f32;\n            let a3 = RSQUARED_2D - dx3 * dx3 - dy3 * dy3;\n            if a3 > 0.0 {\n                value +=\n                    (a3 * a3) * (a3 * a3) * grad2(seed, xsbp + Wrapping(PRIME_X), ysbp, dx3, dy3);\n            }\n        }\n    } else {\n        if xi + xmyi < 0.0 {\n            let dx2 = dx0 + (1.0 + UNSKEW_2D) as f32;\n            let dy2 = dy0 + UNSKEW_2D as f32;\n            let a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n            if a2 > 0.0 {\n                value +=\n                    (a2 * a2) * (a2 * a2) * grad2(seed, xsbp - Wrapping(PRIME_X), ysbp, dx2, dy2);\n            }\n        } else {\n            let dx2 = dx0 - (UNSKEW_2D + 1.0) as f32;\n            let dy2 = dy0 - UNSKEW_2D as f32;\n            let a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n            if a2 > 0.0 {\n                value +=\n                    (a2 * a2) * (a2 * a2) * grad2(seed, xsbp + Wrapping(PRIME_X), ysbp, dx2, dy2);\n            }\n        }\n\n        if yi < xmyi {\n            let dx2 = dx0 + UNSKEW_2D as f32;\n            let dy2 = dy0 + (UNSKEW_2D + 1.0) as f32;\n            let a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n            if a2 > 0.0 {\n                value +=\n                    (a2 * a2) * (a2 * a2) * grad2(seed, xsbp, ysbp - Wrapping(PRIME_Y), dx2, dy2);\n            }\n        } else {\n            let dx2 = dx0 - UNSKEW_2D as f32;\n            let dy2 = dy0 - (UNSKEW_2D + 1.0) as f32;\n            let a2 = RSQUARED_2D - dx2 * dx2 - dy2 * dy2;\n            if a2 > 0.0 {\n                value +=\n                    (a2 * a2) * (a2 * a2) * grad2(seed, xsbp, ysbp + Wrapping(PRIME_Y), dx2, dy2);\n            }\n        }\n    }\n\n    value\n}\n\n/**\n    3D OpenSimplex2S/SuperSimplex noise, with better visual isotropy in (X, Y).\n    Recommended for 3D terrain and time-varied animations.\n    The Z coordinate should always be the \"different\" coordinate in whatever your use case is.\n    If Y is vertical in world coordinates, call noise3_ImproveXZ(x, z, Y) or use noise3_XZBeforeY.\n    If Z is vertical in world coordinates, call noise3_ImproveXZ(x, y, Z).\n    For a time varied animation, call noise3_ImproveXY(x, y, T).\n*/\npub fn noise3_ImproveXY(seed: i64, x: f64, y: f64, z: f64) -> f32 {\n    // Re-orient the cubic lattices without skewing, so Z points up the main lattice diagonal,\n    // and the planes formed by XY are moved far out of alignment with the cube faces.\n    // Orthonormal rotation. Not a skew transform.\n    let xy = x + y;\n    let s2 = xy * ROTATE3_ORTHOGONALIZER;\n    let zz = z * ROOT3OVER3;\n    let xr = x + s2 + zz;\n    let yr = y + s2 + zz;\n    let zr = xy * -ROOT3OVER3 + zz;\n\n    // Evaluate both lattices to form a BCC lattice.\n    noise3_UnrotatedBase(seed, xr, yr, zr)\n}\n\n/**\n    3D OpenSimplex2S/SuperSimplex noise, with better visual isotropy in (X, Z).\n    Recommended for 3D terrain and time-varied animations.\n    The Y coordinate should always be the \"different\" coordinate in whatever your use case is.\n    If Y is vertical in world coordinates, call noise3_ImproveXZ(x, Y, z).\n    If Z is vertical in world coordinates, call noise3_ImproveXZ(x, Z, y) or use noise3_ImproveXY.\n    For a time varied animation, call noise3_ImproveXZ(x, T, y) or use noise3_ImproveXY.\n*/\npub fn noise3_ImproveXZ(seed: i64, x: f64, y: f64, z: f64) -> f32 {\n    // Re-orient the cubic lattices without skewing, so Y points up the main lattice diagonal,\n    // and the planes formed by XZ are moved far out of alignment with the cube faces.\n    // Orthonormal rotation. Not a skew transform.\n    let xz = x + z;\n    let s2 = xz * -0.211324865405187;\n    let yy = y * ROOT3OVER3;\n    let xr = x + s2 + yy;\n    let zr = z + s2 + yy;\n    let yr = xz * -ROOT3OVER3 + yy;\n\n    // Evaluate both lattices to form a BCC lattice.\n    noise3_UnrotatedBase(seed, xr, yr, zr)\n}\n\n/**\n    3D OpenSimplex2S/SuperSimplex noise, fallback rotation option\n    Use noise3_ImproveXY or noise3_ImproveXZ instead, wherever appropriate.\n    They have less diagonal bias. This function's best use is as a fallback.\n*/\npub fn noise3_Fallback(seed: i64, x: f64, y: f64, z: f64) -> f32 {\n    // Re-orient the cubic lattices via rotation, to produce a familiar look.\n    // Orthonormal rotation. Not a skew transform.\n    let r = FALLBACK_ROTATE3 * (x + y + z);\n    let xr = r - x;\n    let yr = r - y;\n    let zr = r - z;\n\n    // Evaluate both lattices to form a BCC lattice.\n    noise3_UnrotatedBase(seed, xr, yr, zr)\n}\n\n/**\n    Generate overlapping cubic lattices for 3D Re-oriented BCC noise.\n    Lookup table implementation inspired by DigitalShadow.\n    It was actually faster to narrow down the points in the loop itself,\n    than to build up the index with enough info to isolate 8 points.\n*/\nfn noise3_UnrotatedBase(seed: i64, xr: f64, yr: f64, zr: f64) -> f32 {\n    let seed = Wrapping(seed);\n\n    // Get base points and offsets.\n    let xrb = fastFloor(xr);\n    let yrb = fastFloor(yr);\n    let zrb = fastFloor(zr);\n    let xi = (xr - xrb as f64) as f32;\n    let yi = (yr - yrb as f64) as f32;\n    let zi = (zr - zrb as f64) as f32;\n\n    // Prime pre-multiplication for hash. Also flip seed for second lattice copy.\n    let xrbp = Wrapping(xrb as i64) * Wrapping(PRIME_X);\n    let yrbp = Wrapping(yrb as i64) * Wrapping(PRIME_Y);\n    let zrbp = Wrapping(zrb as i64) * Wrapping(PRIME_Z);\n    let seed2 = seed ^ Wrapping(SEED_FLIP_3D);\n\n    // -1 if positive, 0 if negative.\n    let xNMask = (-0.5 - xi) as i32;\n    let yNMask = (-0.5 - yi) as i32;\n    let zNMask = (-0.5 - zi) as i32;\n\n    // First vertex.\n    let x0 = xi + xNMask as f32;\n    let y0 = yi + yNMask as f32;\n    let z0 = zi + zNMask as f32;\n    let a0 = RSQUARED_3D - x0 * x0 - y0 * y0 - z0 * z0;\n    let mut value = (a0 * a0)\n        * (a0 * a0)\n        * grad3(\n            seed,\n            xrbp + (Wrapping(xNMask as i64) & Wrapping(PRIME_X)),\n            yrbp + (Wrapping(yNMask as i64) & Wrapping(PRIME_Y)),\n            zrbp + (Wrapping(zNMask as i64) & Wrapping(PRIME_Z)),\n            x0,\n            y0,\n            z0,\n        );\n\n    // Second vertex.\n    let x1 = xi - 0.5;\n    let y1 = yi - 0.5;\n    let z1 = zi - 0.5;\n    let a1 = RSQUARED_3D - x1 * x1 - y1 * y1 - z1 * z1;\n    value += (a1 * a1)\n        * (a1 * a1)\n        * grad3(\n            seed2,\n            xrbp + Wrapping(PRIME_X),\n            yrbp + Wrapping(PRIME_Y),\n            zrbp + Wrapping(PRIME_Z),\n            x1,\n            y1,\n            z1,\n        );\n\n    // Shortcuts for building the remaining falloffs.\n    // Derived by subtracting the polynomials with the offsets plugged in.\n    let xAFlipMask0 = ((xNMask | 1) << 1) as f32 * x1;\n    let yAFlipMask0 = ((yNMask | 1) << 1) as f32 * y1;\n    let zAFlipMask0 = ((zNMask | 1) << 1) as f32 * z1;\n    let xAFlipMask1 = (-2 - (xNMask << 2)) as f32 * x1 - 1.0;\n    let yAFlipMask1 = (-2 - (yNMask << 2)) as f32 * y1 - 1.0;\n    let zAFlipMask1 = (-2 - (zNMask << 2)) as f32 * z1 - 1.0;\n\n    let mut skip5 = false;\n    let a2 = xAFlipMask0 + a0;\n    if a2 > 0.0 {\n        let x2 = x0 - (xNMask | 1) as f32;\n        let y2 = y0;\n        let z2 = z0;\n        value += (a2 * a2)\n            * (a2 * a2)\n            * grad3(\n                seed,\n                xrbp + (Wrapping(!xNMask as i64) & Wrapping(PRIME_X)),\n                yrbp + (Wrapping(yNMask as i64) & Wrapping(PRIME_Y)),\n                zrbp + (Wrapping(zNMask as i64) & Wrapping(PRIME_Z)),\n                x2,\n                y2,\n                z2,\n            );\n    } else {\n        let a3 = yAFlipMask0 + zAFlipMask0 + a0;\n        if a3 > 0.0 {\n            let x3 = x0;\n            let y3 = y0 - (yNMask | 1) as f32;\n            let z3 = z0 - (zNMask | 1) as f32;\n            value += (a3 * a3)\n                * (a3 * a3)\n                * grad3(\n                    seed,\n                    xrbp + (Wrapping(xNMask as i64) & Wrapping(PRIME_X)),\n                    yrbp + (Wrapping(!yNMask as i64) & Wrapping(PRIME_Y)),\n                    zrbp + (Wrapping(!zNMask as i64) & Wrapping(PRIME_Z)),\n                    x3,\n                    y3,\n                    z3,\n                );\n        }\n\n        let a4 = xAFlipMask1 + a1;\n        if a4 > 0.0 {\n            let x4 = (xNMask | 1) as f32 + x1;\n            let y4 = y1;\n            let z4 = z1;\n            value += (a4 * a4)\n                * (a4 * a4)\n                * grad3(\n                    seed2,\n                    xrbp + (Wrapping(xNMask as i64) & (Wrapping(PRIME_X) << 1)),\n                    yrbp + Wrapping(PRIME_Y),\n                    zrbp + Wrapping(PRIME_Z),\n                    x4,\n                    y4,\n                    z4,\n                );\n            skip5 = true;\n        }\n    }\n\n    let mut skip9 = false;\n    let a6 = yAFlipMask0 + a0;\n    if a6 > 0.0 {\n        let x6 = x0;\n        let y6 = y0 - (yNMask | 1) as f32;\n        let z6 = z0;\n        value += (a6 * a6)\n            * (a6 * a6)\n            * grad3(\n                seed,\n                xrbp + (Wrapping(xNMask as i64) & Wrapping(PRIME_X)),\n                yrbp + (Wrapping(!yNMask as i64) & Wrapping(PRIME_Y)),\n                zrbp + (Wrapping(zNMask as i64) & Wrapping(PRIME_Z)),\n                x6,\n                y6,\n                z6,\n            );\n    } else {\n        let a7 = xAFlipMask0 + zAFlipMask0 + a0;\n        if a7 > 0.0 {\n            let x7 = x0 - (xNMask | 1) as f32;\n            let y7 = y0;\n            let z7 = z0 - (zNMask | 1) as f32;\n            value += (a7 * a7)\n                * (a7 * a7)\n                * grad3(\n                    seed,\n                    xrbp + (Wrapping(!xNMask as i64) & Wrapping(PRIME_X)),\n                    yrbp + (Wrapping(yNMask as i64) & Wrapping(PRIME_Y)),\n                    zrbp + (Wrapping(!zNMask as i64) & Wrapping(PRIME_Z)),\n                    x7,\n                    y7,\n                    z7,\n                );\n        }\n\n        let a8 = yAFlipMask1 + a1;\n        if a8 > 0.0 {\n            let x8 = x1;\n            let y8 = (yNMask | 1) as f32 + y1;\n            let z8 = z1;\n            value += (a8 * a8)\n                * (a8 * a8)\n                * grad3(\n                    seed2,\n                    xrbp + Wrapping(PRIME_X),\n                    yrbp + (Wrapping(yNMask as i64) & (Wrapping(PRIME_Y) << 1)),\n                    zrbp + Wrapping(PRIME_Z),\n                    x8,\n                    y8,\n                    z8,\n                );\n            skip9 = true;\n        }\n    }\n\n    let mut skipD = false;\n    let aA = zAFlipMask0 + a0;\n    if aA > 0.0 {\n        let xA = x0;\n        let yA = y0;\n        let zA = z0 - (zNMask | 1) as f32;\n        value += (aA * aA)\n            * (aA * aA)\n            * grad3(\n                seed,\n                xrbp + (Wrapping(xNMask as i64) & Wrapping(PRIME_X)),\n                yrbp + (Wrapping(yNMask as i64) & Wrapping(PRIME_Y)),\n                zrbp + (Wrapping(!zNMask as i64) & Wrapping(PRIME_Z)),\n                xA,\n                yA,\n                zA,\n            );\n    } else {\n        let aB = xAFlipMask0 + yAFlipMask0 + a0;\n        if aB > 0.0 {\n            let xB = x0 - (xNMask | 1) as f32;\n            let yB = y0 - (yNMask | 1) as f32;\n            let zB = z0;\n            value += (aB * aB)\n                * (aB * aB)\n                * grad3(\n                    seed,\n                    xrbp + (Wrapping(!xNMask as i64) & Wrapping(PRIME_X)),\n                    yrbp + (Wrapping(!yNMask as i64) & Wrapping(PRIME_Y)),\n                    zrbp + (Wrapping(zNMask as i64) & Wrapping(PRIME_Z)),\n                    xB,\n                    yB,\n                    zB,\n                );\n        }\n\n        let aC = zAFlipMask1 + a1;\n        if aC > 0.0 {\n            let xC = x1;\n            let yC = y1;\n            let zC = (zNMask | 1) as f32 + z1;\n            value += (aC * aC)\n                * (aC * aC)\n                * grad3(\n                    seed2,\n                    xrbp + Wrapping(PRIME_X),\n                    yrbp + Wrapping(PRIME_Y),\n                    zrbp + (Wrapping(zNMask as i64) & (Wrapping(PRIME_Z) << 1)),\n                    xC,\n                    yC,\n                    zC,\n                );\n            skipD = true;\n        }\n    }\n\n    if !skip5 {\n        let a5 = yAFlipMask1 + zAFlipMask1 + a1;\n        if a5 > 0.0 {\n            let x5 = x1;\n            let y5 = (yNMask | 1) as f32 + y1;\n            let z5 = (zNMask | 1) as f32 + z1;\n            value += (a5 * a5)\n                * (a5 * a5)\n                * grad3(\n                    seed2,\n                    xrbp + Wrapping(PRIME_X),\n                    yrbp + (Wrapping(yNMask as i64) & (Wrapping(PRIME_Y) << 1)),\n                    zrbp + (Wrapping(zNMask as i64) & (Wrapping(PRIME_Z) << 1)),\n                    x5,\n                    y5,\n                    z5,\n                );\n        }\n    }\n\n    if !skip9 {\n        let a9 = xAFlipMask1 + zAFlipMask1 + a1;\n        if a9 > 0.0 {\n            let x9 = (xNMask | 1) as f32 + x1;\n            let y9 = y1;\n            let z9 = (zNMask | 1) as f32 + z1;\n            value += (a9 * a9)\n                * (a9 * a9)\n                * grad3(\n                    seed2,\n                    xrbp + (Wrapping(xNMask as i64) & (Wrapping(PRIME_X) << 1)),\n                    yrbp + Wrapping(PRIME_Y),\n                    zrbp + (Wrapping(zNMask as i64) & (Wrapping(PRIME_Z) << 1)),\n                    x9,\n                    y9,\n                    z9,\n                );\n        }\n    }\n\n    if !skipD {\n        let aD = xAFlipMask1 + yAFlipMask1 + a1;\n        if aD > 0.0 {\n            let xD = (xNMask | 1) as f32 + x1;\n            let yD = (yNMask | 1) as f32 + y1;\n            let zD = z1;\n            value += (aD * aD)\n                * (aD * aD)\n                * grad3(\n                    seed2,\n                    xrbp + (Wrapping(xNMask as i64) & (Wrapping(PRIME_X) << 1)),\n                    yrbp + (Wrapping(yNMask as i64) & (Wrapping(PRIME_Y) << 1)),\n                    zrbp + Wrapping(PRIME_Z),\n                    xD,\n                    yD,\n                    zD,\n                );\n        }\n    }\n\n    value\n}\n\n/**\n    4D SuperSimplex noise, with XYZ oriented like noise3_ImproveXY\n    and W for an extra degree of freedom. W repeats eventually.\n    Recommended for time-varied animations which texture a 3D object (W=time)\n    in a space where Z is vertical\n*/\npub fn noise4_ImproveXYZ_ImproveXY(seed: i64, x: f64, y: f64, z: f64, w: f64) -> f32 {\n    let xy = x + y;\n    let s2 = xy * -0.21132486540518699998;\n    let zz = z * 0.28867513459481294226;\n    let ww = w * 1.118033988749894;\n    let xr = x + (zz + ww + s2);\n    let yr = y + (zz + ww + s2);\n    let zr = xy * -0.57735026918962599998 + (zz + ww);\n    let wr = z * -0.866025403784439 + ww;\n\n    noise4_UnskewedBase(seed, xr, yr, zr, wr)\n}\n\n/**\n    4D SuperSimplex noise, with XYZ oriented like noise3_ImproveXZ\n    and W for an extra degree of freedom. W repeats eventually.\n    Recommended for time-varied animations which texture a 3D object (W=time)\n    in a space where Y is vertical\n*/\npub fn noise4_ImproveXYZ_ImproveXZ(seed: i64, x: f64, y: f64, z: f64, w: f64) -> f32 {\n    let xz = x + z;\n    let s2 = xz * -0.21132486540518699998;\n    let yy = y * 0.28867513459481294226;\n    let ww = w * 1.118033988749894;\n    let xr = x + (yy + ww + s2);\n    let zr = z + (yy + ww + s2);\n    let yr = xz * -0.57735026918962599998 + (yy + ww);\n    let wr = y * -0.866025403784439 + ww;\n\n    noise4_UnskewedBase(seed, xr, yr, zr, wr)\n}\n\n/**\n    4D SuperSimplex noise, with XYZ oriented like noise3_Fallback\n    and W for an extra degree of freedom. W repeats eventually.\n    Recommended for time-varied animations which texture a 3D object (W=time)\n    where there isn't a clear distinction between horizontal and vertical\n*/\npub fn noise4_ImproveXYZ(seed: i64, x: f64, y: f64, z: f64, w: f64) -> f32 {\n    let xyz = x + y + z;\n    let ww = w * 1.118033988749894;\n    let s2 = xyz * -0.16666666666666666 + ww;\n    let xs = x + s2;\n    let ys = y + s2;\n    let zs = z + s2;\n    let ws = -0.5 * xyz + ww;\n\n    noise4_UnskewedBase(seed, xs, ys, zs, ws)\n}\n\n/**\n    4D SuperSimplex noise, with XY and ZW forming orthogonal triangular-based planes.\n    Recommended for 3D terrain, where X and Y (or Z and W) are horizontal.\n    Recommended for noise(x, y, sin(time), cos(time)) trick.\n*/\npub fn noise4_ImproveXY_ImproveZW(seed: i64, x: f64, y: f64, z: f64, w: f64) -> f32 {\n    let s2 = (x + y) * -0.28522513987434876941 + (z + w) * 0.83897065470611435718;\n    let t2 = (z + w) * 0.21939749883706435719 + (x + y) * -0.48214856493302476942;\n    let xs = x + s2;\n    let ys = y + s2;\n    let zs = z + t2;\n    let ws = w + t2;\n\n    noise4_UnskewedBase(seed, xs, ys, zs, ws)\n}\n\n/**\n    4D SuperSimplex noise, fallback lattice orientation.\n*/\npub fn noise4_Fallback(seed: i64, x: f64, y: f64, z: f64, w: f64) -> f32 {\n    // Get points for A4 lattice\n    let s = SKEW_4D as f64 * (x + y + z + w);\n    let xs = x + s;\n    let ys = y + s;\n    let zs = z + s;\n    let ws = w + s;\n\n    noise4_UnskewedBase(seed, xs, ys, zs, ws)\n}\n\n/**\n    4D SuperSimplex noise base.\n    Using ultra-simple 4x4x4x4 lookup partitioning.\n    This isn't as elegant or SIMD/GPU/etc. portable as other approaches,\n    but it competes performance-wise with optimized 2014 OpenSimplex.\n*/\nfn noise4_UnskewedBase(seed: i64, xs: f64, ys: f64, zs: f64, ws: f64) -> f32 {\n    let seed = Wrapping(seed);\n\n    // Get base points and offsets\n    let xsb = fastFloor(xs);\n    let ysb = fastFloor(ys);\n    let zsb = fastFloor(zs);\n    let wsb = fastFloor(ws);\n    let xsi = (xs - xsb as f64) as f32;\n    let ysi = (ys - ysb as f64) as f32;\n    let zsi = (zs - zsb as f64) as f32;\n    let wsi = (ws - wsb as f64) as f32;\n\n    // Unskewed offsets\n    let ssi = (xsi + ysi + zsi + wsi) * UNSKEW_4D;\n    let xi = xsi + ssi;\n    let yi = ysi + ssi;\n    let zi = zsi + ssi;\n    let wi = wsi + ssi;\n\n    // Prime pre-multiplication for hash.\n    let xsvp = Wrapping(xsb as i64) * Wrapping(PRIME_X);\n    let ysvp = Wrapping(ysb as i64) * Wrapping(PRIME_Y);\n    let zsvp = Wrapping(zsb as i64) * Wrapping(PRIME_Z);\n    let wsvp = Wrapping(wsb as i64) * Wrapping(PRIME_W);\n\n    // Index into initial table.\n    let index = ((fastFloor(xs * 4.0) & 3) << 0)\n        | ((fastFloor(ys * 4.0) & 3) << 2)\n        | ((fastFloor(zs * 4.0) & 3) << 4)\n        | ((fastFloor(ws * 4.0) & 3) << 6);\n\n    // Point contributions\n    let staticData = getStaticData();\n    let mut value = 0.0;\n    let secondaryIndexStartAndStop = staticData.lookup4DA[index as usize];\n    let secondaryIndexStart = secondaryIndexStartAndStop & 0xFFFF;\n    let secondaryIndexStop = secondaryIndexStartAndStop >> 16;\n    for i in secondaryIndexStart..secondaryIndexStop {\n        let c = &staticData.lookup4DB[i];\n        let dx = xi + c.dx;\n        let dy = yi + c.dy;\n        let dz = zi + c.dz;\n        let dw = wi + c.dw;\n        let mut a = (dx * dx + dy * dy) + (dz * dz + dw * dw);\n        if a < RSQUARED_4D {\n            a -= RSQUARED_4D;\n            a *= a;\n            value += a\n                * a\n                * grad4(\n                    seed,\n                    xsvp + Wrapping(c.xsvp),\n                    ysvp + Wrapping(c.ysvp),\n                    zsvp + Wrapping(c.zsvp),\n                    wsvp + Wrapping(c.wsvp),\n                    dx,\n                    dy,\n                    dz,\n                    dw,\n                );\n        }\n    }\n    value\n}\n\n/*\n    Utility\n*/\n\nfn grad2(seed: Wrapping<i64>, xsvp: Wrapping<i64>, ysvp: Wrapping<i64>, dx: f32, dy: f32) -> f32 {\n    let mut hash = seed ^ xsvp ^ ysvp;\n    hash *= HASH_MULTIPLIER;\n    hash ^= hash.0 >> (64 - N_GRADS_2D_EXPONENT + 1);\n    let gi = (hash.0 as i32 & ((N_GRADS_2D - 1) << 1)) as usize;\n    let grads = &getStaticData().gradients2D;\n    grads[gi | 0] * dx + grads[gi | 1] * dy\n}\n\nfn grad3(\n    seed: Wrapping<i64>,\n    xrvp: Wrapping<i64>,\n    yrvp: Wrapping<i64>,\n    zrvp: Wrapping<i64>,\n    dx: f32,\n    dy: f32,\n    dz: f32,\n) -> f32 {\n    let mut hash = (seed ^ xrvp) ^ (yrvp ^ zrvp);\n    hash *= HASH_MULTIPLIER;\n    hash ^= hash.0 >> (64 - N_GRADS_3D_EXPONENT + 2);\n    let gi = (hash.0 as i32 & ((N_GRADS_3D - 1) << 2)) as usize;\n    let grads = &getStaticData().gradients3D;\n    grads[gi | 0] * dx + grads[gi | 1] * dy + grads[gi | 2] * dz\n}\n\nfn grad4(\n    seed: Wrapping<i64>,\n    xsvp: Wrapping<i64>,\n    ysvp: Wrapping<i64>,\n    zsvp: Wrapping<i64>,\n    wsvp: Wrapping<i64>,\n    dx: f32,\n    dy: f32,\n    dz: f32,\n    dw: f32,\n) -> f32 {\n    let mut hash = seed ^ (xsvp ^ ysvp) ^ (zsvp ^ wsvp);\n    hash *= HASH_MULTIPLIER;\n    hash ^= hash.0 >> (64 - N_GRADS_4D_EXPONENT + 2);\n    let gi = (hash.0 as i32 & ((N_GRADS_4D - 1) << 2)) as usize;\n    let grads = &getStaticData().gradients4D;\n    (grads[gi | 0] * dx + grads[gi | 1] * dy) + (grads[gi | 2] * dz + grads[gi | 3] * dw)\n}\n\nfn fastFloor(x: f64) -> i32 {\n    let xi = x as i32;\n    if x < xi as f64 {\n        xi - 1\n    } else {\n        xi\n    }\n}\n\n/*\n    Lookup Tables & Gradients\n*/\n\n#[derive(Clone, Default)]\nstruct LatticeVertex4D {\n    pub dx: f32,\n    pub dy: f32,\n    pub dz: f32,\n    pub dw: f32,\n    pub xsvp: i64,\n    pub ysvp: i64,\n    pub zsvp: i64,\n    pub wsvp: i64,\n}\n\nimpl LatticeVertex4D {\n    pub fn new(xsv: i32, ysv: i32, zsv: i32, wsv: i32) -> Self {\n        let ssv = (xsv + ysv + zsv + wsv) as f32 * UNSKEW_4D;\n        Self {\n            xsvp: (Wrapping(xsv as i64) * Wrapping(PRIME_X)).0,\n            ysvp: (Wrapping(ysv as i64) * Wrapping(PRIME_Y)).0,\n            zsvp: (Wrapping(zsv as i64) * Wrapping(PRIME_Z)).0,\n            wsvp: (Wrapping(wsv as i64) * Wrapping(PRIME_W)).0,\n            dx: -xsv as f32 - ssv,\n            dy: -ysv as f32 - ssv,\n            dz: -zsv as f32 - ssv,\n            dw: -wsv as f32 - ssv,\n        }\n    }\n}\n\nstruct StaticData {\n    gradients2D: Vec<f32>,\n    gradients3D: Vec<f32>,\n    gradients4D: Vec<f32>,\n\n    lookup4DA: Vec<usize>,\n    lookup4DB: Vec<LatticeVertex4D>,\n}\n\nstatic mut STATIC_DATA: (Once, Option<StaticData>) = (Once::new(), None);\n\nfn getStaticData() -> &'static StaticData {\n    unsafe {\n        STATIC_DATA.0.call_once(|| {\n            STATIC_DATA.1 = Some(initStaticData());\n        });\n        STATIC_DATA.1.as_ref().unwrap()\n    }\n}\n\nfn initStaticData() -> StaticData {\n    let gradients2D: Vec<_> = GRAD2_SRC\n        .into_iter()\n        .map(|v| (v / NORMALIZER_2D) as f32)\n        .collect::<Vec<_>>() // cache divisions\n        .into_iter()\n        .cycle()\n        .take((N_GRADS_2D * 2) as usize)\n        .collect();\n\n    let gradients3D: Vec<_> = GRAD3_SRC\n        .into_iter()\n        .map(|v| (v / NORMALIZER_3D) as f32)\n        .collect::<Vec<_>>() // cache divisions\n        .into_iter()\n        .cycle()\n        .take((N_GRADS_3D * 4) as usize)\n        .collect();\n\n    let gradients4D: Vec<_> = GRAD4_SRC\n        .into_iter()\n        .map(|v| (v / NORMALIZER_4D) as f32)\n        .collect::<Vec<_>>() // cache divisions\n        .into_iter()\n        .cycle()\n        .take((N_GRADS_4D * 4) as usize)\n        .collect();\n\n    let nLatticeVerticesTotal = LOOKUP_4D_VERTEX_CODES.iter().map(|v| v.len()).sum();\n    let latticeVerticesByCode: Vec<_> = (0..256)\n        .map(|i| {\n            let cx = ((i >> 0) & 3) - 1;\n            let cy = ((i >> 2) & 3) - 1;\n            let cz = ((i >> 4) & 3) - 1;\n            let cw = ((i >> 6) & 3) - 1;\n            LatticeVertex4D::new(cx, cy, cz, cw)\n        })\n        .collect();\n    let mut lookup4DA = vec![0; 256];\n    let mut lookup4DB = vec![Default::default(); nLatticeVerticesTotal];\n    let mut j = 0;\n    for i in 0..256 {\n        lookup4DA[i] = j | ((j + LOOKUP_4D_VERTEX_CODES[i].len()) << 16);\n        for k in 0..LOOKUP_4D_VERTEX_CODES[i].len() {\n            lookup4DB[j] = latticeVerticesByCode[LOOKUP_4D_VERTEX_CODES[i][k] as usize].clone();\n            j += 1;\n        }\n    }\n\n    StaticData {\n        gradients2D,\n        gradients3D,\n        gradients4D,\n        lookup4DA,\n        lookup4DB,\n    }\n}\n\n#[rustfmt::skip]\nconst GRAD2_SRC: &[f64] = &[\n    0.38268343236509,   0.923879532511287,\n    0.923879532511287,  0.38268343236509,\n    0.923879532511287, -0.38268343236509,\n    0.38268343236509,  -0.923879532511287,\n    -0.38268343236509,  -0.923879532511287,\n    -0.923879532511287, -0.38268343236509,\n    -0.923879532511287,  0.38268343236509,\n    -0.38268343236509,   0.923879532511287,\n    //-------------------------------------//\n    0.130526192220052,  0.99144486137381,\n    0.608761429008721,  0.793353340291235,\n    0.793353340291235,  0.608761429008721,\n    0.99144486137381,   0.130526192220051,\n    0.99144486137381,  -0.130526192220051,\n    0.793353340291235, -0.60876142900872,\n    0.608761429008721, -0.793353340291235,\n    0.130526192220052, -0.99144486137381,\n    -0.130526192220052, -0.99144486137381,\n    -0.608761429008721, -0.793353340291235,\n    -0.793353340291235, -0.608761429008721,\n    -0.99144486137381,  -0.130526192220052,\n    -0.99144486137381,   0.130526192220051,\n    -0.793353340291235,  0.608761429008721,\n    -0.608761429008721,  0.793353340291235,\n    -0.130526192220052,  0.99144486137381,\n];\n\n#[rustfmt::skip]\nconst GRAD3_SRC: &[f64] = &[\n    2.22474487139,       2.22474487139,      -1.0,                 0.0,\n    2.22474487139,       2.22474487139,       1.0,                 0.0,\n    3.0862664687972017,  1.1721513422464978,  0.0,                 0.0,\n    1.1721513422464978,  3.0862664687972017,  0.0,                 0.0,\n    -2.22474487139,       2.22474487139,      -1.0,                 0.0,\n    -2.22474487139,       2.22474487139,       1.0,                 0.0,\n    -1.1721513422464978,  3.0862664687972017,  0.0,                 0.0,\n    -3.0862664687972017,  1.1721513422464978,  0.0,                 0.0,\n    -1.0,                -2.22474487139,      -2.22474487139,       0.0,\n    1.0,                -2.22474487139,      -2.22474487139,       0.0,\n    0.0,                -3.0862664687972017, -1.1721513422464978,  0.0,\n    0.0,                -1.1721513422464978, -3.0862664687972017,  0.0,\n    -1.0,                -2.22474487139,       2.22474487139,       0.0,\n    1.0,                -2.22474487139,       2.22474487139,       0.0,\n    0.0,                -1.1721513422464978,  3.0862664687972017,  0.0,\n    0.0,                -3.0862664687972017,  1.1721513422464978,  0.0,\n    //--------------------------------------------------------------------//\n    -2.22474487139,      -2.22474487139,      -1.0,                 0.0,\n    -2.22474487139,      -2.22474487139,       1.0,                 0.0,\n    -3.0862664687972017, -1.1721513422464978,  0.0,                 0.0,\n    -1.1721513422464978, -3.0862664687972017,  0.0,                 0.0,\n    -2.22474487139,      -1.0,                -2.22474487139,       0.0,\n    -2.22474487139,       1.0,                -2.22474487139,       0.0,\n    -1.1721513422464978,  0.0,                -3.0862664687972017,  0.0,\n    -3.0862664687972017,  0.0,                -1.1721513422464978,  0.0,\n    -2.22474487139,      -1.0,                 2.22474487139,       0.0,\n    -2.22474487139,       1.0,                 2.22474487139,       0.0,\n    -3.0862664687972017,  0.0,                 1.1721513422464978,  0.0,\n    -1.1721513422464978,  0.0,                 3.0862664687972017,  0.0,\n    -1.0,                 2.22474487139,      -2.22474487139,       0.0,\n    1.0,                 2.22474487139,      -2.22474487139,       0.0,\n    0.0,                 1.1721513422464978, -3.0862664687972017,  0.0,\n    0.0,                 3.0862664687972017, -1.1721513422464978,  0.0,\n    -1.0,                 2.22474487139,       2.22474487139,       0.0,\n    1.0,                 2.22474487139,       2.22474487139,       0.0,\n    0.0,                 3.0862664687972017,  1.1721513422464978,  0.0,\n    0.0,                 1.1721513422464978,  3.0862664687972017,  0.0,\n    2.22474487139,      -2.22474487139,      -1.0,                 0.0,\n    2.22474487139,      -2.22474487139,       1.0,                 0.0,\n    1.1721513422464978, -3.0862664687972017,  0.0,                 0.0,\n    3.0862664687972017, -1.1721513422464978,  0.0,                 0.0,\n    2.22474487139,      -1.0,                -2.22474487139,       0.0,\n    2.22474487139,       1.0,                -2.22474487139,       0.0,\n    3.0862664687972017,  0.0,                -1.1721513422464978,  0.0,\n    1.1721513422464978,  0.0,                -3.0862664687972017,  0.0,\n    2.22474487139,      -1.0,                 2.22474487139,       0.0,\n    2.22474487139,       1.0,                 2.22474487139,       0.0,\n    1.1721513422464978,  0.0,                 3.0862664687972017,  0.0,\n    3.0862664687972017,  0.0,                 1.1721513422464978,  0.0,\n];\n\n#[rustfmt::skip]\nconst GRAD4_SRC: &[f64] = &[\n    -0.6740059517812944,   -0.3239847771997537,   -0.3239847771997537,    0.5794684678643381,\n    -0.7504883828755602,   -0.4004672082940195,    0.15296486218853164,   0.5029860367700724,\n    -0.7504883828755602,    0.15296486218853164,  -0.4004672082940195,    0.5029860367700724,\n    -0.8828161875373585,    0.08164729285680945,   0.08164729285680945,   0.4553054119602712,\n    -0.4553054119602712,   -0.08164729285680945,  -0.08164729285680945,   0.8828161875373585,\n    -0.5029860367700724,   -0.15296486218853164,   0.4004672082940195,    0.7504883828755602,\n    -0.5029860367700724,    0.4004672082940195,   -0.15296486218853164,   0.7504883828755602,\n    -0.5794684678643381,    0.3239847771997537,    0.3239847771997537,    0.6740059517812944,\n    -0.6740059517812944,   -0.3239847771997537,    0.5794684678643381,   -0.3239847771997537,\n    -0.7504883828755602,   -0.4004672082940195,    0.5029860367700724,    0.15296486218853164,\n    -0.7504883828755602,    0.15296486218853164,   0.5029860367700724,   -0.4004672082940195,\n    -0.8828161875373585,    0.08164729285680945,   0.4553054119602712,    0.08164729285680945,\n    -0.4553054119602712,   -0.08164729285680945,   0.8828161875373585,   -0.08164729285680945,\n    -0.5029860367700724,   -0.15296486218853164,   0.7504883828755602,    0.4004672082940195,\n    -0.5029860367700724,    0.4004672082940195,    0.7504883828755602,   -0.15296486218853164,\n    -0.5794684678643381,    0.3239847771997537,    0.6740059517812944,    0.3239847771997537,\n    -0.6740059517812944,    0.5794684678643381,   -0.3239847771997537,   -0.3239847771997537,\n    -0.7504883828755602,    0.5029860367700724,   -0.4004672082940195,    0.15296486218853164,\n    -0.7504883828755602,    0.5029860367700724,    0.15296486218853164,  -0.4004672082940195,\n    -0.8828161875373585,    0.4553054119602712,    0.08164729285680945,   0.08164729285680945,\n    -0.4553054119602712,    0.8828161875373585,   -0.08164729285680945,  -0.08164729285680945,\n    -0.5029860367700724,    0.7504883828755602,   -0.15296486218853164,   0.4004672082940195,\n    -0.5029860367700724,    0.7504883828755602,    0.4004672082940195,   -0.15296486218853164,\n    -0.5794684678643381,    0.6740059517812944,    0.3239847771997537,    0.3239847771997537,\n    0.5794684678643381,   -0.6740059517812944,   -0.3239847771997537,   -0.3239847771997537,\n    0.5029860367700724,   -0.7504883828755602,   -0.4004672082940195,    0.15296486218853164,\n    0.5029860367700724,   -0.7504883828755602,    0.15296486218853164,  -0.4004672082940195,\n    0.4553054119602712,   -0.8828161875373585,    0.08164729285680945,   0.08164729285680945,\n    0.8828161875373585,   -0.4553054119602712,   -0.08164729285680945,  -0.08164729285680945,\n    0.7504883828755602,   -0.5029860367700724,   -0.15296486218853164,   0.4004672082940195,\n    0.7504883828755602,   -0.5029860367700724,    0.4004672082940195,   -0.15296486218853164,\n    0.6740059517812944,   -0.5794684678643381,    0.3239847771997537,    0.3239847771997537,\n    //------------------------------------------------------------------------------------------//\n    -0.753341017856078,    -0.37968289875261624,  -0.37968289875261624,  -0.37968289875261624,\n    -0.7821684431180708,   -0.4321472685365301,   -0.4321472685365301,    0.12128480194602098,\n    -0.7821684431180708,   -0.4321472685365301,    0.12128480194602098,  -0.4321472685365301,\n    -0.7821684431180708,    0.12128480194602098,  -0.4321472685365301,   -0.4321472685365301,\n    -0.8586508742123365,   -0.508629699630796,     0.044802370851755174,  0.044802370851755174,\n    -0.8586508742123365,    0.044802370851755174, -0.508629699630796,     0.044802370851755174,\n    -0.8586508742123365,    0.044802370851755174,  0.044802370851755174, -0.508629699630796,\n    -0.9982828964265062,   -0.03381941603233842,  -0.03381941603233842,  -0.03381941603233842,\n    -0.37968289875261624,  -0.753341017856078,    -0.37968289875261624,  -0.37968289875261624,\n    -0.4321472685365301,   -0.7821684431180708,   -0.4321472685365301,    0.12128480194602098,\n    -0.4321472685365301,   -0.7821684431180708,    0.12128480194602098,  -0.4321472685365301,\n    0.12128480194602098,  -0.7821684431180708,   -0.4321472685365301,   -0.4321472685365301,\n    -0.508629699630796,    -0.8586508742123365,    0.044802370851755174,  0.044802370851755174,\n    0.044802370851755174, -0.8586508742123365,   -0.508629699630796,     0.044802370851755174,\n    0.044802370851755174, -0.8586508742123365,    0.044802370851755174, -0.508629699630796,\n    -0.03381941603233842,  -0.9982828964265062,   -0.03381941603233842,  -0.03381941603233842,\n    -0.37968289875261624,  -0.37968289875261624,  -0.753341017856078,    -0.37968289875261624,\n    -0.4321472685365301,   -0.4321472685365301,   -0.7821684431180708,    0.12128480194602098,\n    -0.4321472685365301,    0.12128480194602098,  -0.7821684431180708,   -0.4321472685365301,\n    0.12128480194602098,  -0.4321472685365301,   -0.7821684431180708,   -0.4321472685365301,\n    -0.508629699630796,     0.044802370851755174, -0.8586508742123365,    0.044802370851755174,\n    0.044802370851755174, -0.508629699630796,    -0.8586508742123365,    0.044802370851755174,\n    0.044802370851755174,  0.044802370851755174, -0.8586508742123365,   -0.508629699630796,\n    -0.03381941603233842,  -0.03381941603233842,  -0.9982828964265062,   -0.03381941603233842,\n    -0.37968289875261624,  -0.37968289875261624,  -0.37968289875261624,  -0.753341017856078,\n    -0.4321472685365301,   -0.4321472685365301,    0.12128480194602098,  -0.7821684431180708,\n    -0.4321472685365301,    0.12128480194602098,  -0.4321472685365301,   -0.7821684431180708,\n    0.12128480194602098,  -0.4321472685365301,   -0.4321472685365301,   -0.7821684431180708,\n    -0.508629699630796,     0.044802370851755174,  0.044802370851755174, -0.8586508742123365,\n    0.044802370851755174, -0.508629699630796,     0.044802370851755174, -0.8586508742123365,\n    0.044802370851755174,  0.044802370851755174, -0.508629699630796,    -0.8586508742123365,\n    -0.03381941603233842,  -0.03381941603233842,  -0.03381941603233842,  -0.9982828964265062,\n    -0.3239847771997537,   -0.6740059517812944,   -0.3239847771997537,    0.5794684678643381,\n    -0.4004672082940195,   -0.7504883828755602,    0.15296486218853164,   0.5029860367700724,\n    0.15296486218853164,  -0.7504883828755602,   -0.4004672082940195,    0.5029860367700724,\n    0.08164729285680945,  -0.8828161875373585,    0.08164729285680945,   0.4553054119602712,\n    -0.08164729285680945,  -0.4553054119602712,   -0.08164729285680945,   0.8828161875373585,\n    -0.15296486218853164,  -0.5029860367700724,    0.4004672082940195,    0.7504883828755602,\n    0.4004672082940195,   -0.5029860367700724,   -0.15296486218853164,   0.7504883828755602,\n    0.3239847771997537,   -0.5794684678643381,    0.3239847771997537,    0.6740059517812944,\n    -0.3239847771997537,   -0.3239847771997537,   -0.6740059517812944,    0.5794684678643381,\n    -0.4004672082940195,    0.15296486218853164,  -0.7504883828755602,    0.5029860367700724,\n    0.15296486218853164,  -0.4004672082940195,   -0.7504883828755602,    0.5029860367700724,\n    0.08164729285680945,   0.08164729285680945,  -0.8828161875373585,    0.4553054119602712,\n    -0.08164729285680945,  -0.08164729285680945,  -0.4553054119602712,    0.8828161875373585,\n    -0.15296486218853164,   0.4004672082940195,   -0.5029860367700724,    0.7504883828755602,\n    0.4004672082940195,   -0.15296486218853164,  -0.5029860367700724,    0.7504883828755602,\n    0.3239847771997537,    0.3239847771997537,   -0.5794684678643381,    0.6740059517812944,\n    -0.3239847771997537,   -0.6740059517812944,    0.5794684678643381,   -0.3239847771997537,\n    -0.4004672082940195,   -0.7504883828755602,    0.5029860367700724,    0.15296486218853164,\n    0.15296486218853164,  -0.7504883828755602,    0.5029860367700724,   -0.4004672082940195,\n    0.08164729285680945,  -0.8828161875373585,    0.4553054119602712,    0.08164729285680945,\n    -0.08164729285680945,  -0.4553054119602712,    0.8828161875373585,   -0.08164729285680945,\n    -0.15296486218853164,  -0.5029860367700724,    0.7504883828755602,    0.4004672082940195,\n    0.4004672082940195,   -0.5029860367700724,    0.7504883828755602,   -0.15296486218853164,\n    0.3239847771997537,   -0.5794684678643381,    0.6740059517812944,    0.3239847771997537,\n    -0.3239847771997537,   -0.3239847771997537,    0.5794684678643381,   -0.6740059517812944,\n    -0.4004672082940195,    0.15296486218853164,   0.5029860367700724,   -0.7504883828755602,\n    0.15296486218853164,  -0.4004672082940195,    0.5029860367700724,   -0.7504883828755602,\n    0.08164729285680945,   0.08164729285680945,   0.4553054119602712,   -0.8828161875373585,\n    -0.08164729285680945,  -0.08164729285680945,   0.8828161875373585,   -0.4553054119602712,\n    -0.15296486218853164,   0.4004672082940195,    0.7504883828755602,   -0.5029860367700724,\n    0.4004672082940195,   -0.15296486218853164,   0.7504883828755602,   -0.5029860367700724,\n    0.3239847771997537,    0.3239847771997537,    0.6740059517812944,   -0.5794684678643381,\n    -0.3239847771997537,    0.5794684678643381,   -0.6740059517812944,   -0.3239847771997537,\n    -0.4004672082940195,    0.5029860367700724,   -0.7504883828755602,    0.15296486218853164,\n    0.15296486218853164,   0.5029860367700724,   -0.7504883828755602,   -0.4004672082940195,\n    0.08164729285680945,   0.4553054119602712,   -0.8828161875373585,    0.08164729285680945,\n    -0.08164729285680945,   0.8828161875373585,   -0.4553054119602712,   -0.08164729285680945,\n    -0.15296486218853164,   0.7504883828755602,   -0.5029860367700724,    0.4004672082940195,\n    0.4004672082940195,    0.7504883828755602,   -0.5029860367700724,   -0.15296486218853164,\n    0.3239847771997537,    0.6740059517812944,   -0.5794684678643381,    0.3239847771997537,\n    -0.3239847771997537,    0.5794684678643381,   -0.3239847771997537,   -0.6740059517812944,\n    -0.4004672082940195,    0.5029860367700724,    0.15296486218853164,  -0.7504883828755602,\n    0.15296486218853164,   0.5029860367700724,   -0.4004672082940195,   -0.7504883828755602,\n    0.08164729285680945,   0.4553054119602712,    0.08164729285680945,  -0.8828161875373585,\n    -0.08164729285680945,   0.8828161875373585,   -0.08164729285680945,  -0.4553054119602712,\n    -0.15296486218853164,   0.7504883828755602,    0.4004672082940195,   -0.5029860367700724,\n    0.4004672082940195,    0.7504883828755602,   -0.15296486218853164,  -0.5029860367700724,\n    0.3239847771997537,    0.6740059517812944,    0.3239847771997537,   -0.5794684678643381,\n    0.5794684678643381,   -0.3239847771997537,   -0.6740059517812944,   -0.3239847771997537,\n    0.5029860367700724,   -0.4004672082940195,   -0.7504883828755602,    0.15296486218853164,\n    0.5029860367700724,    0.15296486218853164,  -0.7504883828755602,   -0.4004672082940195,\n    0.4553054119602712,    0.08164729285680945,  -0.8828161875373585,    0.08164729285680945,\n    0.8828161875373585,   -0.08164729285680945,  -0.4553054119602712,   -0.08164729285680945,\n    0.7504883828755602,   -0.15296486218853164,  -0.5029860367700724,    0.4004672082940195,\n    0.7504883828755602,    0.4004672082940195,   -0.5029860367700724,   -0.15296486218853164,\n    0.6740059517812944,    0.3239847771997537,   -0.5794684678643381,    0.3239847771997537,\n    0.5794684678643381,   -0.3239847771997537,   -0.3239847771997537,   -0.6740059517812944,\n    0.5029860367700724,   -0.4004672082940195,    0.15296486218853164,  -0.7504883828755602,\n    0.5029860367700724,    0.15296486218853164,  -0.4004672082940195,   -0.7504883828755602,\n    0.4553054119602712,    0.08164729285680945,   0.08164729285680945,  -0.8828161875373585,\n    0.8828161875373585,   -0.08164729285680945,  -0.08164729285680945,  -0.4553054119602712,\n    0.7504883828755602,   -0.15296486218853164,   0.4004672082940195,   -0.5029860367700724,\n    0.7504883828755602,    0.4004672082940195,   -0.15296486218853164,  -0.5029860367700724,\n    0.6740059517812944,    0.3239847771997537,    0.3239847771997537,   -0.5794684678643381,\n    0.03381941603233842,   0.03381941603233842,   0.03381941603233842,   0.9982828964265062,\n    -0.044802370851755174, -0.044802370851755174,  0.508629699630796,     0.8586508742123365,\n    -0.044802370851755174,  0.508629699630796,    -0.044802370851755174,  0.8586508742123365,\n    -0.12128480194602098,   0.4321472685365301,    0.4321472685365301,    0.7821684431180708,\n    0.508629699630796,    -0.044802370851755174, -0.044802370851755174,  0.8586508742123365,\n    0.4321472685365301,   -0.12128480194602098,   0.4321472685365301,    0.7821684431180708,\n    0.4321472685365301,    0.4321472685365301,   -0.12128480194602098,   0.7821684431180708,\n    0.37968289875261624,   0.37968289875261624,   0.37968289875261624,   0.753341017856078,\n    0.03381941603233842,   0.03381941603233842,   0.9982828964265062,    0.03381941603233842,\n    -0.044802370851755174,  0.044802370851755174,  0.8586508742123365,    0.508629699630796,\n    -0.044802370851755174,  0.508629699630796,     0.8586508742123365,   -0.044802370851755174,\n    -0.12128480194602098,   0.4321472685365301,    0.7821684431180708,    0.4321472685365301,\n    0.508629699630796,    -0.044802370851755174,  0.8586508742123365,   -0.044802370851755174,\n    0.4321472685365301,   -0.12128480194602098,   0.7821684431180708,    0.4321472685365301,\n    0.4321472685365301,    0.4321472685365301,    0.7821684431180708,   -0.12128480194602098,\n    0.37968289875261624,   0.37968289875261624,   0.753341017856078,     0.37968289875261624,\n    0.03381941603233842,   0.9982828964265062,    0.03381941603233842,   0.03381941603233842,\n    -0.044802370851755174,  0.8586508742123365,   -0.044802370851755174,  0.508629699630796,\n    -0.044802370851755174,  0.8586508742123365,    0.508629699630796,    -0.044802370851755174,\n    -0.12128480194602098,   0.7821684431180708,    0.4321472685365301,    0.4321472685365301,\n    0.508629699630796,     0.8586508742123365,   -0.044802370851755174, -0.044802370851755174,\n    0.4321472685365301,    0.7821684431180708,   -0.12128480194602098,   0.4321472685365301,\n    0.4321472685365301,    0.7821684431180708,    0.4321472685365301,   -0.12128480194602098,\n    0.37968289875261624,   0.753341017856078,     0.37968289875261624,   0.37968289875261624,\n    0.9982828964265062,    0.03381941603233842,   0.03381941603233842,   0.03381941603233842,\n    0.8586508742123365,   -0.044802370851755174, -0.044802370851755174,  0.508629699630796,\n    0.8586508742123365,   -0.044802370851755174,  0.508629699630796,    -0.044802370851755174,\n    0.7821684431180708,   -0.12128480194602098,   0.4321472685365301,    0.4321472685365301,\n    0.8586508742123365,    0.508629699630796,    -0.044802370851755174, -0.044802370851755174,\n    0.7821684431180708,    0.4321472685365301,   -0.12128480194602098,   0.4321472685365301,\n    0.7821684431180708,    0.4321472685365301,    0.4321472685365301,   -0.12128480194602098,\n    0.753341017856078,     0.37968289875261624,   0.37968289875261624,   0.37968289875261624,\n];\n\n#[rustfmt::skip]\nconst LOOKUP_4D_VERTEX_CODES: &[&[u8]] = &[\n    &[0x15, 0x45, 0x51, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA],\n    &[0x15, 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xAA],\n    &[0x01, 0x05, 0x11, 0x15, 0x41, 0x45, 0x51, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA],\n    &[0x01, 0x15, 0x16, 0x45, 0x46, 0x51, 0x52, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB],\n    &[0x15, 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA9, 0xAA],\n    &[0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xAA],\n    &[0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xAA],\n    &[0x05, 0x15, 0x16, 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xAA, 0xAB],\n    &[0x04, 0x05, 0x14, 0x15, 0x44, 0x45, 0x54, 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA],\n    &[0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xAA],\n    &[0x05, 0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x9A, 0xAA],\n    &[0x05, 0x15, 0x16, 0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x5B, 0x6A, 0x9A, 0xAA, 0xAB],\n    &[0x04, 0x15, 0x19, 0x45, 0x49, 0x54, 0x55, 0x58, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE],\n    &[0x05, 0x15, 0x19, 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xAA, 0xAE],\n    &[0x05, 0x15, 0x19, 0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x5E, 0x6A, 0x9A, 0xAA, 0xAE],\n    &[0x05, 0x15, 0x1A, 0x45, 0x4A, 0x55, 0x56, 0x59, 0x5A, 0x5B, 0x5E, 0x6A, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF],\n    &[0x15, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0xA5, 0xA6, 0xA9, 0xAA],\n    &[0x11, 0x15, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xAA],\n    &[0x11, 0x15, 0x51, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x96, 0xA6, 0xAA],\n    &[0x11, 0x15, 0x16, 0x51, 0x52, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x96, 0xA6, 0xAA, 0xAB],\n    &[0x14, 0x15, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA9, 0xAA],\n    &[0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x9A, 0xA6, 0xA9, 0xAA],\n    &[0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB],\n    &[0x15, 0x16, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x6B, 0x96, 0x9A, 0xA6, 0xAA, 0xAB],\n    &[0x14, 0x15, 0x54, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x99, 0xA9, 0xAA],\n    &[0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE],\n    &[0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x9A, 0xAA],\n    &[0x15, 0x16, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x6B, 0x9A, 0xAA, 0xAB],\n    &[0x14, 0x15, 0x19, 0x54, 0x55, 0x58, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x99, 0xA9, 0xAA, 0xAE],\n    &[0x15, 0x19, 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x6E, 0x99, 0x9A, 0xA9, 0xAA, 0xAE],\n    &[0x15, 0x19, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x6E, 0x9A, 0xAA, 0xAE],\n    &[0x15, 0x1A, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x6B, 0x6E, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF],\n    &[0x10, 0x11, 0x14, 0x15, 0x50, 0x51, 0x54, 0x55, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA],\n    &[0x11, 0x15, 0x51, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xAA],\n    &[0x11, 0x15, 0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0xA6, 0xAA],\n    &[0x11, 0x15, 0x16, 0x51, 0x52, 0x55, 0x56, 0x65, 0x66, 0x67, 0x6A, 0xA6, 0xAA, 0xAB],\n    &[0x14, 0x15, 0x54, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA9, 0xAA],\n    &[0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA],\n    &[0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA6, 0xAA],\n    &[0x15, 0x16, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x6B, 0xA6, 0xAA, 0xAB],\n    &[0x14, 0x15, 0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0xA9, 0xAA],\n    &[0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA9, 0xAA],\n    &[0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xAA],\n    &[0x15, 0x16, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6B, 0xAA, 0xAB],\n    &[0x14, 0x15, 0x19, 0x54, 0x55, 0x58, 0x59, 0x65, 0x69, 0x6A, 0x6D, 0xA9, 0xAA, 0xAE],\n    &[0x15, 0x19, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x6E, 0xA9, 0xAA, 0xAE],\n    &[0x15, 0x19, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6E, 0xAA, 0xAE],\n    &[0x15, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x69, 0x6A, 0x6B, 0x6E, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF],\n    &[0x10, 0x15, 0x25, 0x51, 0x54, 0x55, 0x61, 0x64, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA],\n    &[0x11, 0x15, 0x25, 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xAA, 0xBA],\n    &[0x11, 0x15, 0x25, 0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x6A, 0x76, 0xA6, 0xAA, 0xBA],\n    &[0x11, 0x15, 0x26, 0x51, 0x55, 0x56, 0x62, 0x65, 0x66, 0x67, 0x6A, 0x76, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB],\n    &[0x14, 0x15, 0x25, 0x54, 0x55, 0x59, 0x64, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA9, 0xAA, 0xBA],\n    &[0x15, 0x25, 0x55, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA],\n    &[0x15, 0x25, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xA6, 0xAA, 0xBA],\n    &[0x15, 0x26, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x6B, 0x7A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB],\n    &[0x14, 0x15, 0x25, 0x54, 0x55, 0x59, 0x64, 0x65, 0x69, 0x6A, 0x79, 0xA9, 0xAA, 0xBA],\n    &[0x15, 0x25, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xA9, 0xAA, 0xBA],\n    &[0x15, 0x25, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x7A, 0xAA, 0xBA],\n    &[0x15, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6B, 0x7A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB],\n    &[0x14, 0x15, 0x29, 0x54, 0x55, 0x59, 0x65, 0x68, 0x69, 0x6A, 0x6D, 0x79, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE],\n    &[0x15, 0x29, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x6E, 0x7A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE],\n    &[0x15, 0x55, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6E, 0x7A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE],\n    &[0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x6B, 0x6E, 0x7A, 0xAA, 0xAB, 0xAE, 0xBA, 0xBF],\n    &[0x45, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA],\n    &[0x41, 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xAA],\n    &[0x41, 0x45, 0x51, 0x55, 0x56, 0x5A, 0x66, 0x95, 0x96, 0x9A, 0xA6, 0xAA],\n    &[0x41, 0x45, 0x46, 0x51, 0x52, 0x55, 0x56, 0x5A, 0x66, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB],\n    &[0x44, 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA9, 0xAA],\n    &[0x45, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA],\n    &[0x45, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xAB],\n    &[0x45, 0x46, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB],\n    &[0x44, 0x45, 0x54, 0x55, 0x59, 0x5A, 0x69, 0x95, 0x99, 0x9A, 0xA9, 0xAA],\n    &[0x45, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xAE],\n    &[0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xAA],\n    &[0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x96, 0x9A, 0x9B, 0xAA, 0xAB],\n    &[0x44, 0x45, 0x49, 0x54, 0x55, 0x58, 0x59, 0x5A, 0x69, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE],\n    &[0x45, 0x49, 0x55, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE],\n    &[0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x99, 0x9A, 0x9E, 0xAA, 0xAE],\n    &[0x45, 0x4A, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x9A, 0x9B, 0x9E, 0xAA, 0xAB, 0xAE, 0xAF],\n    &[0x50, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x95, 0x96, 0x99, 0xA5, 0xA6, 0xA9, 0xAA],\n    &[0x51, 0x55, 0x56, 0x59, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA],\n    &[0x51, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xAB],\n    &[0x51, 0x52, 0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xA7, 0xAA, 0xAB],\n    &[0x54, 0x55, 0x56, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA],\n    &[0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA],\n    &[0x15, 0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB],\n    &[0x55, 0x56, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB],\n    &[0x54, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAE],\n    &[0x15, 0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE],\n    &[0x15, 0x45, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE],\n    &[0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB],\n    &[0x54, 0x55, 0x58, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAD, 0xAE],\n    &[0x55, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE],\n    &[0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE],\n    &[0x55, 0x56, 0x59, 0x5A, 0x6A, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF],\n    &[0x50, 0x51, 0x54, 0x55, 0x65, 0x66, 0x69, 0x95, 0xA5, 0xA6, 0xA9, 0xAA],\n    &[0x51, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA],\n    &[0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xAA],\n    &[0x51, 0x52, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x96, 0xA6, 0xA7, 0xAA, 0xAB],\n    &[0x54, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA],\n    &[0x15, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA],\n    &[0x15, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xBA],\n    &[0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB],\n    &[0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA9, 0xAA],\n    &[0x15, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xBA],\n    &[0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x9A, 0xA6, 0xA9, 0xAA],\n    &[0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x96, 0x9A, 0xA6, 0xAA, 0xAB],\n    &[0x54, 0x55, 0x58, 0x59, 0x65, 0x69, 0x6A, 0x99, 0xA9, 0xAA, 0xAD, 0xAE],\n    &[0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE],\n    &[0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x99, 0x9A, 0xA9, 0xAA, 0xAE],\n    &[0x15, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x69, 0x6A, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF],\n    &[0x50, 0x51, 0x54, 0x55, 0x61, 0x64, 0x65, 0x66, 0x69, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA],\n    &[0x51, 0x55, 0x61, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA],\n    &[0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x6A, 0xA5, 0xA6, 0xAA, 0xB6, 0xBA],\n    &[0x51, 0x55, 0x56, 0x62, 0x65, 0x66, 0x6A, 0xA6, 0xA7, 0xAA, 0xAB, 0xB6, 0xBA, 0xBB],\n    &[0x54, 0x55, 0x64, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA],\n    &[0x55, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA],\n    &[0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA],\n    &[0x55, 0x56, 0x65, 0x66, 0x6A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB],\n    &[0x54, 0x55, 0x59, 0x64, 0x65, 0x69, 0x6A, 0xA5, 0xA9, 0xAA, 0xB9, 0xBA],\n    &[0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA],\n    &[0x15, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA],\n    &[0x15, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB],\n    &[0x54, 0x55, 0x59, 0x65, 0x68, 0x69, 0x6A, 0xA9, 0xAA, 0xAD, 0xAE, 0xB9, 0xBA, 0xBE],\n    &[0x55, 0x59, 0x65, 0x69, 0x6A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE],\n    &[0x15, 0x55, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE],\n    &[0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0xAA, 0xAB, 0xAE, 0xBA, 0xBF],\n    &[0x40, 0x41, 0x44, 0x45, 0x50, 0x51, 0x54, 0x55, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA],\n    &[0x41, 0x45, 0x51, 0x55, 0x56, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xAA],\n    &[0x41, 0x45, 0x51, 0x55, 0x56, 0x95, 0x96, 0x9A, 0xA6, 0xAA],\n    &[0x41, 0x45, 0x46, 0x51, 0x52, 0x55, 0x56, 0x95, 0x96, 0x97, 0x9A, 0xA6, 0xAA, 0xAB],\n    &[0x44, 0x45, 0x54, 0x55, 0x59, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA9, 0xAA],\n    &[0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA],\n    &[0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA],\n    &[0x45, 0x46, 0x55, 0x56, 0x5A, 0x95, 0x96, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB],\n    &[0x44, 0x45, 0x54, 0x55, 0x59, 0x95, 0x99, 0x9A, 0xA9, 0xAA],\n    &[0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA],\n    &[0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xAA],\n    &[0x45, 0x46, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9B, 0xAA, 0xAB],\n    &[0x44, 0x45, 0x49, 0x54, 0x55, 0x58, 0x59, 0x95, 0x99, 0x9A, 0x9D, 0xA9, 0xAA, 0xAE],\n    &[0x45, 0x49, 0x55, 0x59, 0x5A, 0x95, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE],\n    &[0x45, 0x49, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9E, 0xAA, 0xAE],\n    &[0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x96, 0x99, 0x9A, 0x9B, 0x9E, 0xAA, 0xAB, 0xAE, 0xAF],\n    &[0x50, 0x51, 0x54, 0x55, 0x65, 0x95, 0x96, 0x99, 0xA5, 0xA6, 0xA9, 0xAA],\n    &[0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA],\n    &[0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA],\n    &[0x51, 0x52, 0x55, 0x56, 0x66, 0x95, 0x96, 0x9A, 0xA6, 0xA7, 0xAA, 0xAB],\n    &[0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA],\n    &[0x45, 0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA],\n    &[0x45, 0x51, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xEA],\n    &[0x55, 0x56, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB],\n    &[0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA],\n    &[0x45, 0x54, 0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xEA],\n    &[0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA],\n    &[0x45, 0x55, 0x56, 0x59, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xAB],\n    &[0x54, 0x55, 0x58, 0x59, 0x69, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAD, 0xAE],\n    &[0x55, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE],\n    &[0x45, 0x55, 0x56, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xAE],\n    &[0x45, 0x55, 0x56, 0x59, 0x5A, 0x6A, 0x96, 0x99, 0x9A, 0xAA, 0xAB, 0xAE, 0xAF],\n    &[0x50, 0x51, 0x54, 0x55, 0x65, 0x95, 0xA5, 0xA6, 0xA9, 0xAA],\n    &[0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA],\n    &[0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xAA],\n    &[0x51, 0x52, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB],\n    &[0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA],\n    &[0x51, 0x54, 0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA],\n    &[0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA],\n    &[0x51, 0x55, 0x56, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xAB],\n    &[0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA],\n    &[0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA],\n    &[0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA],\n    &[0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB],\n    &[0x54, 0x55, 0x58, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE],\n    &[0x54, 0x55, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAE],\n    &[0x55, 0x56, 0x59, 0x5A, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAE],\n    &[0x55, 0x56, 0x59, 0x5A, 0x66, 0x69, 0x6A, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xAF],\n    &[0x50, 0x51, 0x54, 0x55, 0x61, 0x64, 0x65, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xB5, 0xBA],\n    &[0x51, 0x55, 0x61, 0x65, 0x66, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA],\n    &[0x51, 0x55, 0x56, 0x61, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0xB6, 0xBA],\n    &[0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x96, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB, 0xB6, 0xBA, 0xBB],\n    &[0x54, 0x55, 0x64, 0x65, 0x69, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA],\n    &[0x55, 0x65, 0x66, 0x69, 0x6A, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA],\n    &[0x51, 0x55, 0x56, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA],\n    &[0x51, 0x55, 0x56, 0x65, 0x66, 0x6A, 0x96, 0xA5, 0xA6, 0xAA, 0xAB, 0xBA, 0xBB],\n    &[0x54, 0x55, 0x59, 0x64, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xB9, 0xBA],\n    &[0x54, 0x55, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA],\n    &[0x55, 0x56, 0x59, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA],\n    &[0x55, 0x56, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xBA, 0xBB],\n    &[0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x99, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE, 0xB9, 0xBA, 0xBE],\n    &[0x54, 0x55, 0x59, 0x65, 0x69, 0x6A, 0x99, 0xA5, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE],\n    &[0x55, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xBA, 0xBE],\n    &[0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xBA],\n    &[0x40, 0x45, 0x51, 0x54, 0x55, 0x85, 0x91, 0x94, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA],\n    &[0x41, 0x45, 0x51, 0x55, 0x56, 0x85, 0x91, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xAA, 0xEA],\n    &[0x41, 0x45, 0x51, 0x55, 0x56, 0x85, 0x91, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xD6, 0xEA],\n    &[0x41, 0x45, 0x51, 0x55, 0x56, 0x86, 0x92, 0x95, 0x96, 0x97, 0x9A, 0xA6, 0xAA, 0xAB, 0xD6, 0xEA, 0xEB],\n    &[0x44, 0x45, 0x54, 0x55, 0x59, 0x85, 0x94, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xEA],\n    &[0x45, 0x55, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xDA, 0xEA],\n    &[0x45, 0x55, 0x56, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xDA, 0xEA],\n    &[0x45, 0x55, 0x56, 0x86, 0x95, 0x96, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB, 0xDA, 0xEA, 0xEB],\n    &[0x44, 0x45, 0x54, 0x55, 0x59, 0x85, 0x94, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xD9, 0xEA],\n    &[0x45, 0x55, 0x59, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xDA, 0xEA],\n    &[0x45, 0x55, 0x56, 0x59, 0x5A, 0x85, 0x95, 0x96, 0x99, 0x9A, 0xAA, 0xDA, 0xEA],\n    &[0x45, 0x55, 0x56, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9B, 0xA6, 0xAA, 0xAB, 0xDA, 0xEA, 0xEB],\n    &[0x44, 0x45, 0x54, 0x55, 0x59, 0x89, 0x95, 0x98, 0x99, 0x9A, 0x9D, 0xA9, 0xAA, 0xAE, 0xD9, 0xEA, 0xEE],\n    &[0x45, 0x55, 0x59, 0x89, 0x95, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE, 0xDA, 0xEA, 0xEE],\n    &[0x45, 0x55, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9E, 0xA9, 0xAA, 0xAE, 0xDA, 0xEA, 0xEE],\n    &[0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0x9B, 0x9E, 0xAA, 0xAB, 0xAE, 0xDA, 0xEA, 0xEF],\n    &[0x50, 0x51, 0x54, 0x55, 0x65, 0x91, 0x94, 0x95, 0x96, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA],\n    &[0x51, 0x55, 0x91, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xE6, 0xEA],\n    &[0x51, 0x55, 0x56, 0x91, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xE6, 0xEA],\n    &[0x51, 0x55, 0x56, 0x92, 0x95, 0x96, 0x9A, 0xA6, 0xA7, 0xAA, 0xAB, 0xE6, 0xEA, 0xEB],\n    &[0x54, 0x55, 0x94, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xE9, 0xEA],\n    &[0x55, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA],\n    &[0x55, 0x56, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA],\n    &[0x55, 0x56, 0x95, 0x96, 0x9A, 0xA6, 0xAA, 0xAB, 0xEA, 0xEB],\n    &[0x54, 0x55, 0x59, 0x94, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xE9, 0xEA],\n    &[0x55, 0x59, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA],\n    &[0x45, 0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA],\n    &[0x45, 0x55, 0x56, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xAA, 0xAB, 0xEA, 0xEB],\n    &[0x54, 0x55, 0x59, 0x95, 0x98, 0x99, 0x9A, 0xA9, 0xAA, 0xAD, 0xAE, 0xE9, 0xEA, 0xEE],\n    &[0x55, 0x59, 0x95, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE],\n    &[0x45, 0x55, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE],\n    &[0x55, 0x56, 0x59, 0x5A, 0x95, 0x96, 0x99, 0x9A, 0xAA, 0xAB, 0xAE, 0xEA, 0xEF],\n    &[0x50, 0x51, 0x54, 0x55, 0x65, 0x91, 0x94, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xE5, 0xEA],\n    &[0x51, 0x55, 0x65, 0x91, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xE6, 0xEA],\n    &[0x51, 0x55, 0x56, 0x65, 0x66, 0x91, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0xE6, 0xEA],\n    &[0x51, 0x55, 0x56, 0x66, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB, 0xE6, 0xEA, 0xEB],\n    &[0x54, 0x55, 0x65, 0x94, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xE9, 0xEA],\n    &[0x55, 0x65, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA],\n    &[0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA],\n    &[0x51, 0x55, 0x56, 0x66, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xAA, 0xAB, 0xEA, 0xEB],\n    &[0x54, 0x55, 0x59, 0x65, 0x69, 0x94, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xE9, 0xEA],\n    &[0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA],\n    &[0x55, 0x56, 0x59, 0x65, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xEA],\n    &[0x55, 0x56, 0x5A, 0x66, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xEA, 0xEB],\n    &[0x54, 0x55, 0x59, 0x69, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE, 0xE9, 0xEA, 0xEE],\n    &[0x54, 0x55, 0x59, 0x69, 0x95, 0x99, 0x9A, 0xA5, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE],\n    &[0x55, 0x59, 0x5A, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xEA, 0xEE],\n    &[0x55, 0x56, 0x59, 0x5A, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xEA],\n    &[0x50, 0x51, 0x54, 0x55, 0x65, 0x95, 0xA1, 0xA4, 0xA5, 0xA6, 0xA9, 0xAA, 0xB5, 0xBA, 0xE5, 0xEA, 0xFA],\n    &[0x51, 0x55, 0x65, 0x95, 0xA1, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA, 0xE6, 0xEA, 0xFA],\n    &[0x51, 0x55, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xB6, 0xBA, 0xE6, 0xEA, 0xFA],\n    &[0x51, 0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA7, 0xAA, 0xAB, 0xB6, 0xBA, 0xE6, 0xEA, 0xFB],\n    &[0x54, 0x55, 0x65, 0x95, 0xA4, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA, 0xE9, 0xEA, 0xFA],\n    &[0x55, 0x65, 0x95, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA],\n    &[0x51, 0x55, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA],\n    &[0x55, 0x56, 0x65, 0x66, 0x95, 0x96, 0xA5, 0xA6, 0xAA, 0xAB, 0xBA, 0xEA, 0xFB],\n    &[0x54, 0x55, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xB9, 0xBA, 0xE9, 0xEA, 0xFA],\n    &[0x54, 0x55, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA],\n    &[0x55, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xBA, 0xEA, 0xFA],\n    &[0x55, 0x56, 0x65, 0x66, 0x6A, 0x95, 0x96, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xBA, 0xEA],\n    &[0x54, 0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xAD, 0xAE, 0xB9, 0xBA, 0xE9, 0xEA, 0xFE],\n    &[0x55, 0x59, 0x65, 0x69, 0x95, 0x99, 0xA5, 0xA9, 0xAA, 0xAE, 0xBA, 0xEA, 0xFE],\n    &[0x55, 0x59, 0x65, 0x69, 0x6A, 0x95, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAE, 0xBA, 0xEA],\n    &[0x55, 0x56, 0x59, 0x5A, 0x65, 0x66, 0x69, 0x6A, 0x95, 0x96, 0x99, 0x9A, 0xA5, 0xA6, 0xA9, 0xAA, 0xAB, 0xAE, 0xBA, 0xEA],\n];\n"
  }
]