double gradCoord1D(int seed, int x, double xd) { int hash = seed; hash ^= X_PRIME * x; hash = hash * hash * hash * 60493; hash = (hash >> 13) ^ hash; return xd * GRAD_1D[hash & 2]; }