public static float noise1 ( float x ) { int bx0 , bx1 ; float rx0 , rx1 , sx , t , u , v ; if ( start ) { start = false ; init ( ) ; } t = x + N ; bx0 = ( ( int ) t ) & BM ; bx1 = ( bx0 + 1 ) & BM ; rx0 = t - ( int ) t ; rx1 = rx0 - 1.0f ; sx = sCurve ( rx0 ) ; u = rx0 * g1 [ p [ bx0 ] ] ; v = rx1 * g1 [ p [ bx1 ] ] ; return 2.3f * lerp ( sx , u , v ) ; }
Compute 1 - dimensional Perlin noise .