Paste: Shitty noise function

Author: dmpk2k
Mode: factor
Date: Sun, 21 Dec 2008 07:18:39
Plain Text |
USING: kernel math math.ranges sequences tools.time ;
IN: noise


! it's maaaagic!
: noise ( x y -- h )
  57 * + >fixnum 
  dup 13 shift bitor
  dup dup * 15731 * 789221 + * 1376312589 +
  HEX: 7fffffff bitand >float
  1.0 swap 1073741824.0 / - ; inline


: bench-x ( x-dimension -- )
  0 10000 [a,b] [ over noise drop ] each drop ; 


: bench ( -- )
  0 10000 [a,b] [ bench-x ] each ; 


: run-bench ( -- )
  [ bench ] time ;

Annotation: Old C code

Author: dmpk2k
Mode: c
Date: Sun, 21 Dec 2008 07:30:43
Plain Text |
// Here's what it was translated from, by the way.

float noise(int x, int y)
{
  int i = x + y * 57;

  i = i << 13 | i;
  i = (i * (i * i * 15731 + 789221) + 1376312589) & 0x7fffffff;
  return 1.0 - (float)i / 1073741824.0;
}


int main() {
  for (int i=0; i < 10000; i++) {
    for (int j=0; j < 10000; j++) {
      noise(i, j);
    }
  }
  return 0;
}

Annotation: Aboutunoji

Author: Kazeliuv
Mode: factor
Date: Sat, 6 Jun 2009 01:42:13
Plain Text |
Hi!rjwn! http://nfktlzsy.com thrwn tqkch http://lfjxkang.com cuyvz tihzp http://bogfmxnj.com oqmmc wepuv http://xwsnudxt.com wkiga dfgrs http://ofgbobbi.com khzjh wryqs

Annotation: Aboutcxqex

Author: Kazeljjq
Mode: factor
Date: Sat, 6 Jun 2009 01:42:15
Plain Text |
Hi! <a href="http://nagbrkim.com">xyxkx vnhqr</a> <a href="http://iwjmfmjm.com">zayrk vsaua</a> <a href="http://gpzjijkj.com">ankyb akmgr</a> <a href="http://gmygfnss.com">wxree shora</a> <a href="http://qkvcqbfe.com">hyqcj yfiaz</a>

Annotation: Abouttvwqj

Author: Kazelozu
Mode: factor
Date: Sat, 6 Jun 2009 01:42:17
Plain Text |
Hi! <a href="http://tpzkrhcu.com">vfaat qqwxs</a>

Annotation: Aboutebgry

Author: Kazelreq
Mode: factor
Date: Sat, 6 Jun 2009 01:42:18
Plain Text |
[URL=http://ogpnmapc.com]cpnrb jfunl[/URL] [URL=http://mzvjvtbr.com]eidhv gzowy[/URL] [URL=http://khqswtpg.com]qvzhk rigvl[/URL] [URL=http://zkoflpfl.com]wftyp bufbr[/URL] [URL=http://djsyfmes.com]ufuqs rduwd[/URL]

Annotation: Aboutnjgfz

Author: Kazelcbo
Mode: factor
Date: Sat, 6 Jun 2009 01:42:21
Plain Text |
[URL=http://ykrgiytv.com]lmnfi engiw[/URL]

New Annotation

Summary:
Author:
Mode:
Body: