ã¯ããã«
ã·ã§ã¼ãã¼ (HLSL) ã§ä¹±æ°ãçºçãããããªããã¨ããã°ãã°ããã¾ãã
ç´æ¥çã«ã¯ãã¯ã¤ããã¤ãºãéæ¥çã«ã¯ãã¼ãªã³ãã¤ãºãªã©ãæãããã¾ãã
ããããã·ã§ã¼ãã¼ãæ¸ãããã¨ãããæ¹ã¯ã frac(sin(...))
ã¿ãããªæ¬ä¼¼ä¹±æ°çæå¨ãç®ã«ãã¦ãããã¨ã§ãããã
ã§ãããä¹±æ°ãçºçãããææ³ã¯æã®æ°ã»ã©åå¨ãã¾ããå質ãé度ãããããç°ãªãæ¬ä¼¼ä¹±æ°çæå¨ãããããããã¾ãã
æ¬ç¨¿ã§ã¯ãããã®ã·ã§ã¼ãã¼ä¹±æ°ã®æ§è½æ¯è¼ãè¡ã£ã¦ããããã¨æãã¾ãã
ã·ã§ã¼ãã¼ä¹±æ°ã®å®ç¾©
ãã¦ãä¹±æ°ã¨ã¯ãã£ã¦ããã·ã§ã¼ãã¼ã§ãã使ãããä¹±æ°ã¯ CPU ãã¼ã¹ã® (ã¡ã«ã»ã³ããã¤ã¹ã¿ ã¨ãã®) æ¬ä¼¼ä¹±æ°çæå¨ã¨ã¯è¨è¨ã¬ãã«ã§ç°ãªããã¨ãå¤ãã§ãã
ã¾ããç¶æ
ãæããªãããã種ã®ããã·ã¥é¢æ°ã®ãããªå®è£
ããããã¨ãã»ã¨ãã©ã§ãã
大æµã®å ´åã座æ¨ãå¼æ°ã«ã¨ããã¨ã«ãªãã§ããããæ¯ãã¬ã¼ã å¤åããä¹±æ°ã欲ããå ´åã«ã¯ã次å
ã®ä¸ã¤ã«æéãå
¥ããã°ããã§ãã
ããã¦ãåºåã®å¤åã§ãã
CPU ãã¼ã¹ã®ãã®ãªã uint32_t
ã uint64_t
åå
¨é¨ãã«ãã¼ãããããªå ´åãã»ã¨ãã©ã§ãã
ããããä»åã®ç¨éã¯ã·ã§ã¼ãç¨ãªã®ã§ float
åã ã£ãããææª ãããåããã° OK ãã¿ãããªå ´åãããã¾ãã
ä¾ãã°ãæ¹è¯ãã¼ãªã³ãã¤ãºãªã 12 éãã®ä¹±æ°ãå¾ãããã°åãã¾ãããã¯ã¤ããã¤ãºã (HDR ã§ãªããã°) 256 éãããã°ååã§ãããã
ä»åã¯ãè¿ãå¤ã¯ float
ã® ã§ãæä½ã§ã 256 éã (ãã ããã§ããã° éã以ä¸) ã®å¤ãå¾ããããã¨ãè¦ä»¶ã¨ãã¾ãã
以ä¸ãããã·ã°ããã£ã¯ãããªæãã«ãªãããã§ããã
// returns [0, 1) float rand(float4 pos) { ... }
ãã®ã·ã°ããã£ã«åããªãé¢æ°ã¯ãæ¦ã以ä¸ã®æ¹éã§æ¹é ãããã®ã¨ãã¾ãã
- å
¥åã足ããªãå ´å
float
ã®ã¿ï¼ç¹°ãè¿ãå¼ã¶f(f(f(f(x) + y) + z) + w)
float2
ãªã©ï¼f(v.xy + v.zw)
- åºåãå¤ãå ´å (
float2
ã¨ããè¿ãå ´å)- ã²ã¨ã¤ã ã使ãï¼
f(v).x
- æãã (ç·åãã¨ãã xor ãããªã©)ï¼
dot(f(v), 1)
- ã²ã¨ã¤ã ã使ãï¼
ã¾ããå
¥å pos
ã¯æ´æ°åº§æ¨ãå
¥ã£ã¦ããã¨ä»®å®ãã¦ããããã®ã¨ãã¾ãã
ã¤ã¾ãã 㨠ãåãå¤ãè¿ããã¨ã許容ãã¾ãã
ããã¯ã©ããã¦ãã¨ããã¨ã第ä¸ã« uint
ãã¼ã¹ã®ã¢ã«ã´ãªãºã ãå¤ãããã第äºã«ãã¼ãªã³ãã¤ãºãªã©ã®å¾é
ãã¯ãã«ãçæããç¨éã§ã¯æ´æ°æ ¼åãªã®ã§å°æ°ä»¥ä¸ã¯ããããè¦ã¦ããªãããã§ãã
ã¤ãã§ã« ±â
ã NaN
ãéæ£è¦åæ°ãªã©ã¸ã®å¯¾å¦ã¯èããªãã¦ãããã®ã¨ãã¾ãã
asint()
é¢æ°ã§ç´æ¥ float
ãã int
ã¸å¤æãããã¨ãã§ãã¾ãããåºæ¬çã«ã¯æ®éã« int
(uint
) ã¸ã®ãã£ã¹ãããããã¨ã«ãã¾ãã
ä¹±æ°ã®å質ã«ã¤ãã¦ã¯ãæ¬ä¼¼ä¹±æ°çæå¨ã®å質ã測ãããã¹ãã¹ã¤ã¼ãã§ãã PractRand ã§ãã¹ããããã¨ã«ãã¾ãã
詳ããã¯å¾è¿°ãã¾ãã
ãªããæ¬ç¨¿ã§ã® float
㯠CPU ã§ã® float
ã¨åãã IEEE 754 è¦æ ¼ã® 32bit å精度浮åå°æ°ç¹æ°ã¨ãã¾ãã
half
ã fixed
ã¯ç²¾åº¦ãç°ãªãããã¢ã«ã´ãªãºã ãç ´ç¶»ãã¾ãã®ã§ãèããªããã®ã¨ãã¾ãã
ç¹ã«ã¢ãã¤ã«åãã®ã·ã§ã¼ããæ¸ãå ´åãä¹±æ°é¢ä¿ã®å®è£
ã«ããã¦ã¯å¿
ã float
精度ã¾ãã¯ããã«ç¸å½ããæå®ãè¡ã£ã¦ãã ããã
以ä¸ãã¾ã¨ããã¨ãã·ã§ã¼ãã¼ä¹±æ°ã®è¦ä»¶ã¯ã
- ç¶æ ãæããªã
- ã·ã°ããã£ã¯
float rand(float4 pos)
pos
ã¯æ´æ°ã¨ãã¦ãã- æ»ãå¤ã¯ ãæä½ 256 éã以ä¸
ã§ãã
PractRand ãã¹ãã«ã¤ãã¦
PractRand ã¯ã 2024 å¹´ç¾å¨ä¸»åã¨ãªãæ¬ä¼¼ä¹±æ°çæå¨ã®ãã¹ãã¹ã¤ã¼ãã§ãã
diehard(er) ã TestU01 ã¨ãã£ãä»ã®ãã¹ãã¹ã¤ã¼ãã«æ¯ã¹ãã¨æ ¼æ®µã«æ¤åºåãé«ãã»ããæ¯è¼çæ©ãåé¡ãçºè¦ãããã¨ãã§ãã¾ãã
å
·ä½çã«ã¯ã TestU01 ã® BigCrush ã ã¨ã©ããªã«éãã¨ã 3 æéç¨åº¦ãããããã«å½é½æ§ãåºã (çã®ä¹±æ°ã§ãã£ã¦ãæ¤å®ã«å¤±æãã) ãã¨ãããã®ã§ããã PractRand ã§ã¯æé㧠1 ç§ç¨åº¦ã§åé¡æ¤åºããããããå½é½æ§ãä»ã®ã¨ãã確èªããã¦ãã¾ããã
PractRand ã®ãã¹ãã«è½ã¡ãã¨ãããã¨ã¯ããå°ãªãã¨ã (ãã¤ãé·) åºåããã¨ãã«ããªãããã®çµ±è¨çã»æ§é çåé¡ãè¦ãããçã®ä¹±æ°ã§ã¯ãªãã¨è¦ç ´ããããã¨ã示ãã¾ãããã¹ãã«è½ã¡ã¦ãä¹±æ°ã¨ãã¦ãå ¨ããå½¹ã«ç«ããªãã¨ãããã¨ã§ã¯ãªãã§ããã客観çãªå質ã®ææ¨ã¨ãã¦å½¹ç«ã¡ã¾ãã
ä»å㯠64 KiB ( ãã¤ã) ããã¹ãã®éå§å°ç¹ã¨ãã 1 TiB ( ãã¤ã) ã¾ã§ãã¹ãã«éãã°é«å質ã ã¨å®ç¾©ãããã¨ã«ãã¾ãã
æ¬ç¨¿ã§ã¯ PractRand ver. 0.94 ã使ç¨ãã¾ããã
ã¡ãªã¿ã«ä½æã¨ãã¦ã¯ã 64 KiB ã§å³åº§ã«å¤±æããæ¬ä¼¼ä¹±æ°çæå¨ã¯äººéã§ãç®ã«è¦ããã¬ãã«ã§åé¡ãããã¾ãã
ã¨ã¦ãéã«ã¾ã¨ããã¨ããã¹ãã«è½ã¡ãã¾ã§ã®ãã¤ãé·ãé·ããã°ä¹±æ°ã¨ãã¦å¼·ãã¨ãããã¨ã§ãã
æ¬æ¥ã®æ¬ä¼¼ä¹±æ°çæå¨ã®ãã¹ãã§ã¯ 32 TiB ç¨åº¦ã¾ã§è¦ãã»ããæ¤å®ã expand ã¢ã¼ãã«ãã¦å®æ½ããããã¾ãããæéããããã®ã§ä»åã¯ããã¾ã§ãã¾ããã
åèã¾ã§ã«ã 1 TiB ã®ãã¹ãã«ã¯å®æ¸¬ 1 ï½ 2 æéãããã¾ãã®ã§ã 32 TiB ã®ãã¹ãã«ã¯åç´è¨ç®ã§ 32 ï½ 64 æé (1 æ¥å ï½ 2 æ¥å) ãããã¾ãã
ãã¹ãç¨ã³ã¼ãã¯ããããæãã§ãã
0, -1, +1, -2, +2, -3, +3, ...
ã¨ããæãã«é²ãã¦ããã 65536 ã«ãªã£ãã 0 ã«æ»ãã¦æ¬¡ã®æ¬¡å
ãå ç®ã«è¡ãã¾ãã
ã¾ããã³ã¼ãã«æ¸ããããã« float
ã®è¿ãå¤ã®ä¸ä½ 16 bit ã ãããã§ãã¯ãããã®ã¨ãã¾ããå®ç¨ä¸ã float
ã®ä¸ä½ãããã«ä½ããã£ã¦ãã»ã¼åé¡ã«ãªããªãã¨èããããã§ãã
class DummyRNG : public PractRand::RNGs::vRNG16 { public: int x, y, z, w; void increment() { x = x >= 0 ? ~x : -x; if (x >= 65536) { x = 0; } else return; y = y >= 0 ? ~y : -y; if (y >= 65536) { y = 0; } else return; z = z >= 0 ? ~z : -z; if (z >= 65536) { z = 0; } else return; w = w >= 0 ? ~w : -w; if (w >= 65536) { w = 0; } } Uint16 raw16() { increment(); // call some shader hashes return (Uint16)(shader(x, y, z, w) * 65536); } void walk_state(PractRand::StateWalkingObject* walker) { x = y = z = w = 0; } std::string get_name() const { return "shaderimpl"; } };
ã¡ãªã¿ã«ããã¹ãã«ãããããã«å ¨é¨ C++ ã«ç§»æ¤ããç¾½ç®ã«ãªãæ³£ãã¦ãã¾ããã
ã·ã§ã¼ãã¼ä¹±æ°ä¸è¦§
ã·ã§ã¼ãã¼ä¹±æ°ãéããã«ããã£ã¦ã網ç¾
çã«èª¿æ»ããã¦ããç´ æµãªè«æ "Hash functions for gpu rendering" ãè¦ã¤ãã¾ããã *1
åºæ¬çã«ã¯ãã®è«æãããã§ã¤ã¹ãã¦ãå¾ã¯ç§ãè¦ã¤ãããã®ã«ã¤ãã¦èª¿æ»ãã¾ãã
ãã®è«æã® "Detailed hash results and code" ã«åç¾ç¨ã®ã³ã¼ããè¼ã£ã¦ããã®ã§ãããããããã®åºå
¸å
ã¨æ¯è¼ããã¨ããç°ãªãå®è£
ãè¡ããã¦ããå ´åãããã¤ãè¦åãããã¾ããã
æ¬ç¨¿ã§ã¯ãªãã¹ãåºå
¸å
ã®å®è£
ãå°éãããããä¸é¨ã§å½è©²è«æã¨ã¯ç°ãªãå®è£
ãè¡ã£ã¦ããå ´åãããã¾ãã
ãªããã·ã°ããã£ã float rand(float4 v)
ã§ã¯ãªããã®ã«é¢ãã¦ã¯ãã§ããã ããªãªã¸ãã«ã«è¿ãå®è£
ã rand_orig()
é¢æ°ã¨ãã¦å®è£
ããå¾ãå¤æã³ã¼ãã rand()
ã«æ¸ããã¨ããéç¨ããã¾ããã
åä¹±æ°ã«ã¯ã以ä¸ã®è¡¨ãã¤ãã¦ãã¾ãã
key | value |
---|---|
Instruction Mix | ãã¯ã»ã«ã·ã§ã¼ãã¼ã®å½ä»¤æ° |
GPU Duration | æç»ã«ããã£ãæé |
FPS | å®æ¸¬ Frames per Second |
PractRand Failed | PractRand ã§æ¤å®å¤±æãããã¤ãé· |
Instruction Mix ã¯ããã¯ã»ã«ã·ã§ã¼ãã¼ã®å½ä»¤æ°ã§ãã NVIDIA Nsight Graphics ã§æ¸¬å®ãã¾ããã
GPU Duration ã¯ã 1024x1024 ã®ãã¯ã¹ãã£ã«æç»ããã¨ãã«ããã£ãæéã§ããããã NSight Graphics ã§æ¸¬å®ãã¾ããã
FPS ã¯ã 1024x1024 ã® quad (UI) ãç¨æãã¦æç»ããã¨ãã® FPS ã§ãããã°ããåä½ããã¦æ大ã®æ°å¤ãè¨é²ãã¾ããã
PractRand Failed ã¯ã PractRand ã§ãã¹ãã«å¤±æããã¨ãã®ãã¤ãé· (2åª) ã§ãã
大ãããã°å¤§ããã»ã©å質ãè¯ãã§ãããã¹ãã«å¤±æããªãã£ãå ´å㯠> 2^41
(â 2 TiB ã®æ¤å®ã«ãã¹ãã) ã®ããã«æä½é確èªã§ããã¨ããã¾ã§è¨è¼ãã¦ãã¾ãã
é度ã®åèã¾ã§ã«ãç½å¡ãããã ãã®ã·ã§ã¼ãã¼ã¯ãããªæãã§ããã
key | value |
---|---|
Instruction Mix | 0 |
GPU Duration | 25.60 μs |
FPS | 2676 |
PractRand Failed | Ã |
æ¹è¯ãã¼ãªã³ãã¤ãºã®å®æ°ãã¼ãã«
static int perlin_permutation[512] = { 151,160,137,91,90,15, 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23, 190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33, 88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166, 77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244, 102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196, 135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123, 5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42, 223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9, 129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228, 251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107, 49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254, 138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180, 151,160,137,91,90,15, 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23, 190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33, 88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166, 77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244, 102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196, 135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123, 5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42, 223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9, 129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228, 251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107, 49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254, 138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180 }; float perlinperm(float4 pos) { return perlin_permutation[ perlin_permutation[ perlin_permutation[ perlin_permutation[int(pos.x) & 0xff] + (int(pos.y) & 0xff)] + (int(pos.z) & 0xff)] + (int(pos.w) & 0xff)] * (1.0 / 256.0); }
ããã¯ãæ¹è¯ãã¼ãªã³ãã¤ãºã®å¾é
ãã¯ãã«çæã«ä½¿ããã¦ããæ¬ä¼¼ä¹±æ°çæå¨ã§ãã *2
äºåã«å®æ°ãã¼ãã«ãçæãã¦ããã¦ãããããã¾ãåç
§ãããã¨ã§ä¹±æ°ãçæãã¾ãã
å®æ°ãã¼ãã«ã¯ã ã®é£çªãé©å½ã«ã·ã£ããã«ãããã®ã 2 ã¤ã¤ãªãã¦é·ã [512]
ã«ãããã¨ã§çæãã¾ãã
2 ã¤ã¤ãªãããã¨ã§ãé½åº¦ &
ãã¨ãå¿
è¦ããªããªã£ã¦ãã¾ãã
å©ç¹ã¨ãã¦ã¯ãå®æ°ãã¼ãã«ãã·ã£ããã«ããªãããã¨ã§ã·ã¼ãå¤ã®è¨å®ãå¯è½ãªãã¨ããã¼ãã«ããã³ãããã¦ãã¾ãã°å®è£
ãç°¡åãªãã¨ãæãããã¾ãã
æ¬ ç¹ã¨ãã¦ã¯ãåº§æ¨ ã¾ã§ãã対å¿ãã¦ããªãã㨠(ãã以éã¯ã«ã¼ããã¾ã) ããããªãã®ãµã¤ãºã®å®æ°ãã¼ãã«ãå¿
è¦ãªãããå®æ°ãã¼ãã«æéããããå¯è½æ§ããããã¨ãæãããã¾ãã
å¾®å¦ã«ãã¿ã¼ã³ãè¦ããæ°ããã¾ããã
key | value |
---|---|
Instruction Mix | 21 |
GPU Duration | 128.0 μs |
FPS | 2501 |
PractRand Failed | 216 |
æ¡ã®å®ãã¹ãã«ãå³åº§ã«è½ã¡ã¦ãã¾ãã
mod289
float mod289_permute(float i) { float im = mod(i, 289.0); return mod(((im * 34.0) + 10.0) * im, 289.0); } float mod289(float4 i) { return mod289_permute( mod289_permute( mod289_permute( mod289_permute(i.w) + i.z) + i.y) + i.x) * (1.0 / 289); }
ããã¯ãã¿ã¤ã«åå¯è½ã·ã³ãã¬ãã¯ã¹ãã¤ãº (psrdnoise
) ã®è«æã§ä½¿ç¨ããã¦ãããå¾é
ãã¯ãã«çæç¨ã®æ¬ä¼¼ä¹±æ°çæå¨ã§ãã *3
ã®é·ç§»å¼ã使ã£ã¦çæãã¾ãã
ããã¯ããæ³¢ã®ãããªãã¿ã¼ã³ãè¦ããæ°ããã¾ããã
key | value |
---|---|
Instruction Mix | 39 |
GPU Duration | 27.65 μs |
FPS | 2656 |
PractRand Failed | 216 |
æ¡ã®å®ãã¹ãã«ãè½ã¡ã¦ãã¾ãã
FNV1
uint fnv1_orig(float x, float y, float z, float w) { const uint prime = 16777619; uint ret = 2166136261; uint key = x; ret *= prime; ret ^= ((key >> 0) & 0xff); ret *= prime; ret ^= ((key >> 8) & 0xff); ret *= prime; ret ^= ((key >> 16) & 0xff); ret *= prime; ret ^= ((key >> 24) & 0xff); key = y; ret *= prime; ret ^= ((key >> 0) & 0xff); ret *= prime; ret ^= ((key >> 8) & 0xff); ret *= prime; ret ^= ((key >> 16) & 0xff); ret *= prime; ret ^= ((key >> 24) & 0xff); key = z; ret *= prime; ret ^= ((key >> 0) & 0xff); ret *= prime; ret ^= ((key >> 8) & 0xff); ret *= prime; ret ^= ((key >> 16) & 0xff); ret *= prime; ret ^= ((key >> 24) & 0xff); key = w; ret *= prime; ret ^= ((key >> 0) & 0xff); ret *= prime; ret ^= ((key >> 8) & 0xff); ret *= prime; ret ^= ((key >> 16) & 0xff); ret *= prime; ret ^= ((key >> 24) & 0xff); return ret; } float fnv1(float4 v) { return fnv1_orig(v.x, v.y, v.z, v.w) * 2.3283064365386962890625e-10; }
GPU ã§ã®ããã·ã¥é¢æ°ã®å®è£
ã«ã¤ãã¦æ¤è¨ãããè«æã«è¼ã£ã¦ãã¾ããã *4
FNV ããã·ã¥ã«ã¤ãã¦ã¯ Wikipedia ãåç
§ãã¦ãã ããã
ã¡ãªã¿ã«ãæå¾ã«æãããã¦ããå®æ° 2.3283064365386962890625e-10
㯠(1.0 / 4294967296) ã§ãã
ãããå°ããªããæ³¢ã®ãããªãã¿ã¼ã³ãè¦ããæ°ããã¾ãã
key | value |
---|---|
Instruction Mix | 50 |
GPU Duration | 30.72 |
FPS | 2656 |
PractRand Failed | 216 |
æ¡ã®å®ãã¹ãã«è½ã¡ã¦ãã¾ãã
JenkinsHash
uint jenkins_orig(float4 v) { uint ret = 0; uint key = v.x; ret += ((key >> 0) & 0xff); ret += ret << 10; ret ^= ret >> 6; ret += ((key >> 8) & 0xff); ret += ret << 10; ret ^= ret >> 6; ret += ((key >> 16) & 0xff); ret += ret << 10; ret ^= ret >> 6; ret += ((key >> 24) & 0xff); ret += ret << 10; ret ^= ret >> 6; key = v.y; ret += ((key >> 0) & 0xff); ret += ret << 10; ret ^= ret >> 6; ret += ((key >> 8) & 0xff); ret += ret << 10; ret ^= ret >> 6; ret += ((key >> 16) & 0xff); ret += ret << 10; ret ^= ret >> 6; ret += ((key >> 24) & 0xff); ret += ret << 10; ret ^= ret >> 6; key = v.z; ret += ((key >> 0) & 0xff); ret += ret << 10; ret ^= ret >> 6; ret += ((key >> 8) & 0xff); ret += ret << 10; ret ^= ret >> 6; ret += ((key >> 16) & 0xff); ret += ret << 10; ret ^= ret >> 6; ret += ((key >> 24) & 0xff); ret += ret << 10; ret ^= ret >> 6; key = v.w; ret += ((key >> 0) & 0xff); ret += ret << 10; ret ^= ret >> 6; ret += ((key >> 8) & 0xff); ret += ret << 10; ret ^= ret >> 6; ret += ((key >> 16) & 0xff); ret += ret << 10; ret ^= ret >> 6; ret += ((key >> 24) & 0xff); ret += ret << 10; ret ^= ret >> 6; ret += ret << 3; ret ^= ret >> 11; ret += ret << 15; return ret; } float jenkins(float4 v) { return jenkins_orig(v) * 2.3283064365386962890625e-10; }
1997 å¹´ã« Bob Jenkins æ°ãéçºããããã·ã¥é¢æ°ã§ãã *5
ä¸è¨ã®æç®ã§ã® one_at_a_time
é¢æ°ãããã§ãã
è¦ãç®ä¸ã¯ç¶ºéºãªãã¯ã¤ããã¤ãºã«ãªã£ã¦ããæ°ããã¾ããã
key | value |
---|---|
Instruction Mix | 93 |
GPU Duration | 27.65 μs |
FPS | 2721 |
PractRand Failed | 221 |
ãããããã¹ãã«ã¯å¤±æãã¦ãã¾ãã
ããããç®è¦ã§ã¯ç¢ºèªã§ããªããããªå質ããã§ãã¯ã§ããã®ã PractRand ã®å¼·ã¿ã§ãã
Blum Blum Shub
uint bbs65521_orig(uint value) { value %= 65521; value = (value * value) % 65521; value = (value * value) % 65521; return value; } float bbs65521(float4 v) { return bbs65521_orig(bbs65521_orig(bbs65521_orig(bbs65521_orig(uint(v.x)) + uint(v.y)) + uint(v.z)) + uint(v.w)) * (1.0 / 65521); }
Blum-Blum-Shub ã¯ã 1986 å¹´ã«çºè¡¨ãããæå·è«çæ¬ä¼¼ä¹±æ°çæå¨ã§ãã *6
ã®æ¼¸åå¼ã§æ´æ°ããã¾ãã
ä»å㯠ã¨ãã¦ãå質åä¸ã®ããã« 2 åå¦çãã¦ããè¿ãã¦ãã¾ãã
æ¬æ¥ã¯ ã«å¤§ããªç´ æ° ãç¨ã㦠ã¨ãªãããã«æ§æããã®ã§ãããä»åã¯å°åçã®ãããªãã®ãªã®ã§ãæå·è«çããªå¼·åº¦ã¯ããã¾ããã
è¦ãç®ä¸ã®éåæã¯ããã¾ãããã
key | value |
---|---|
Instruction Mix | 53 |
GPU Duration | 27.65 μs |
FPS | 2735 |
PractRand Failed | 216 |
ã§ããã¹ãã«ã¯è½ã¡ã¦ãã¾ãã
å ãã¦ãå®æ°ã 4093
ã«å¤ãã¦ãã£ã¦ã¿ããã¼ã¸ã§ã³ã以ä¸ã«ç¤ºãã¾ãã
ãªã 4093
ãªã®ãã¨ããã¨ã float
åã®ç²¾åº¦ã 24 bit åãããªãããã§ãã
2 ã¤ã®æ°ãä¹ç®ããã¨ãã« 24 bit ããªã¼ãã¼ããªãããã«ã¯ãæ³ (mod
ã®é¨å) ããã®å¹³æ¹æ ¹ () 以ä¸ã«ãªãããã«ããªããã°ãªãã¾ããã
ãã®æ¡ä»¶ä¸ã§æã大ããç´ æ°ã ã ããã§ãã
float bbs4093_orig(float seed) { float prime24 = 4093; float s = frac(seed / prime24); s = frac(s * s * prime24); s = frac(s * s * prime24); return s; } float bbs4093(float4 v) { return bbs4093_orig(v.x + bbs4093_orig(v.y + bbs4093_orig(v.z + bbs4093_orig(v.w)))); }
ãããç¹ã«ãã¿ã¼ã³ã¯è¦åããããªãæ°ããã¾ãã
ãã ãåç»ã¨ãã¦è¦ãã¨å·¦å´ã«ç·ã®ãããªãã®ãè¦åãããã¾ããã
key | value |
---|---|
Instruction Mix | 49 |
GPU Duration | 27.65 μs |
FPS | 2667 |
PractRand Failed | 216 |
ããããã¹ãã«ã¯ãã£ã¨ããéã«è½ã¡ã¦ãã¾ãã
CityHash
uint mur(uint a, uint h) { a *= 0xcc9e2d51; a = (a >> 17) | (a << 15); a *= 0x1b873593; h ^= a; h = (h >> 19) | (h << 13); return h * 5 + 0xe6546b64; } uint fmix(uint h) { h ^= h >> 16; h *= 0x85ebca6b; h ^= h >> 13; h *= 0xc2b2ae35; h ^= h >> 16; return h; } uint city_orig(uint4 s) { uint len = 16; uint a = s.y; uint b = s.y; uint c = s.z; uint d = s.z; uint e = s.x; uint f = s.w; uint h = len; return fmix(mur(f, mur(e, mur(d, mur(c, mur(b, mur(a, h))))))); } float city(float4 s) { return city_orig(uint4(s)) * 2.3283064365386962890625e-10; }
CityHash ã¯ã 2011 å¹´ã« google ãéçºããéæå·è«çããã·ã¥é¢æ°ã§ãã *7
ä»åã¯ããã®ä¸ã§ã 32 bit ã®ããã·ã¥å¤ãè¿ã CityHash32
ã使ãã¾ãã
ãã¿ã¼ã³ã¯ç¹ã«è¦åãããã¾ãããã
key | value |
---|---|
Instruction Mix | 49 |
GPU Duration | 27.65 μs |
FPS | 2695 |
PractRand Failed | 241 |
ããã«ãã¦ãããã TiB ã®å£ ( ) ãçªç ´ããæ¬ä¼¼ä¹±æ°çæå¨ (ããã·ã¥?) ãç¾ãã¾ããã
ãããæ¬æ¥ã®ããã·ã¥é¢æ°ãå質ãéãã¾ããã
ESGTSA
uint esgtsa_orig(uint s) { s = (s ^ 2747636419) * 2654435769; s = (s ^ s >> 16) * 2654435769; s = (s ^ s >> 16) * 2654435769; return s; } float esgtsa(float4 v) { return (esgtsa_orig(esgtsa_orig(esgtsa_orig(esgtsa_orig(uint(v.x)) + uint(v.y)) + uint(v.z)) + uint(v.w))) * 2.3283064365386962890625e-10; }
ESGTSA ã¯ã "Evolving sub-grid turbulence for smoke animation" ã¨ããè«æã§ææ¡ããã¦ããã¢ã«ã´ãªãºã ã§ãã *8
è«æã¿ã¤ãã«ã®é æåãã¨ã£ã¦ããããã§ããã
ãã¨ãã¨ã¯ãèªç¶ãªç
ã®ã¢ãã¡ã¼ã·ã§ã³ãçæããããã®è«æã§ãã
keijiro 大å çã«ããã° ã Unity ã® HDRP ã§ããã®å®è£ ã使ããã¦ããããã§ãã
ããããã¿ã¼ã³ã¯è¦åãããã¾ãããã
key | value |
---|---|
Instruction Mix | 38 |
GPU Duration | 26.62 μs |
FPS | 2721 |
PractRand Failed | 240 |
1 TiB ã®ãã¹ãã§ã¡ããã©å¤±æãã¾ããããæ¦ãé«å質ã¨ãããã§ããããã·ã³ãã«ãã®å®è£ ãªã®ã§æå¤ã§ããã
Fast
float fast_orig(float2 v) { v = (1.0 / 4320.0) * v + float2(0.25, 0.0); float state = frac(dot(v * v, float2(3571, 3571))); return frac(state * state * (3571.0 * 2.0)); } float fast(float4 v) { return fast_orig(v.xy + v.zw); }
Unreal Engine ãå
¸æ ãããã§ãã
ç§ã«ã¯ã¢ã¯ã»ã¹æ¨©ããªãã®ã§ç¢ºèªã§ãã¾ããã§ããâ¦â¦
float
åã ã㧠(uint
åãçµç±ããã«) è¨ç®ã§ããã®ããã¤ã³ãã§ããããã
ã¬ã³ãºã®å¹²æ¸æ¨¡æ§ã¿ãããªãã®ãè¦ãã¾ããã
key | value |
---|---|
Instruction Mix | 16 |
GPU Duration | 27.65 μs |
FPS | 2664 |
PractRand Failed | 216 |
ãã¹ãã«ã¯å³åº§ã«è½ã¡ã¦ãã¾ãã¾ããã
Hash without Sine
float hashwosine(float4 p) { p = frac(p * float4(0.1031, 0.1030, 0.0973, 0.1099)); p += dot(p, p.wzxy + 33.33); return frac((p.x + p.y) * (p.z + p.w)); }
ãã®é¢æ°ã¯ã 2014 å¹´ã« Dave_Hoskins æ°ã Shadertoy ä¸ã§çºè¡¨ãããã®ã§ãã *9
sin
é¢æ°ãç°å¢ä¾åã§å¤ãå¤ããåé¡ (å¾è¿°) ã«å¯¾å¦ãã¹ãã sin
ãªãã§è¨ç®ã§ãããã¨ã念é ã«è¨è¨ããã¦ããããã§ãã
å¾®å¦ã«ç¸æ¨¡æ§ãè¦ãããããªãããã§ããªããããªâ¦â¦
key | value |
---|---|
Instruction Mix | 31 |
GPU Duration | 28.67 μs |
FPS | 2702 |
PractRand Failed | 216 |
ãã¹ãã«ã¯å³åº§ã«è½ã¡ã¦ãã¾ãã¾ããã
license
// Hash without Sine
// MIT License...
/ Copyright (c)2014 David Hoskins.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE./
HybridTaus
uint taus(uint z, int s1, int s2, int s3, uint m) { uint b = ((z << s1) ^ z) >> s2; return ((z & m) << s3) ^ b; } uint hybridtaus_orig(uint4 z) { z.x = taus(z.x, 13, 19, 12, 0xfffffffe); z.y = taus(z.y, 2, 25, 4, 0xfffffff8); z.z = taus(z.z, 3, 11, 17, 0xfffffff0); z.w = z.w * 1664525 + 1013904223; return z.x ^ z.y ^ z.z ^ z.w; } float hybridtaus(float4 s) { return hybridtaus_orig(uint4(s)) * 2.3283064365386962890625e-10; }
HybridTaus
ã¯ã 2007 å¹´ã« Howes ãã«ãã£ã¦éçºããã¾ããã *10
Hybrid ã¨ããããã«ã Tausworthe Generator (LFSR; ã¡ã«ã»ã³ããã¤ã¹ã¿ãªã©ã®ç¥å ) 㨠LCG (ç·å½¢ååæ³) ã®ãã¤ããªããã¨ãªã£ã¦ãã¾ãã
ä½ãæ ã£ã¦ãã¾ããã
ã¨ããã®ãã x, y, z
æåãå°ããå ´å (ã¨ãã£ã¦ã 65536 以ä¸ã¨ãããããå ´åã§ã) çµæã¸ã®å¯ä¸ãã»ã¼ 0 ã«ãªãããã§ãã
(æçµçã« float
ã«å¤æããéã¯ä¸ä½ãããã使ããããã x, y, z
ãã»ã¼ä¸ä½ãããã«ããä¼æããªãããã§ãã)
key | value |
---|---|
Instruction Mix | 25 |
GPU Duration | 27.65 μs |
FPS | 2649 |
PractRand Failed | Ã |
è«å¤ãªã®ã§ãã¹ããã¦ãã¾ããã
ããã¾ã§ããå
é¨ç¶æ
ãæ´æ°ãã¦ããæ¬ä¼¼ä¹±æ°çæå¨ãã¨ãã¦ã®éç¨ã主ç¼ã¨ãã¦ãããã®ãªã®ã§ãããã·ã¥ç¨éã«ã¯é£ããã£ãããã§ãã
Interleaved Gradient Noise
float ign_orig(float2 v) { float3 magic = float3(0.06711056, 0.00583715, 52.9829189); return frac(magic.z * frac(dot(v, magic.xy))); } float ign(float4 v) { return ign_orig(v.xy + v.zw); }
Interleaved Gradient Noise ã¯ã 2014 å¹´ã« Jorge Jimenez æ°ã«ãã£ã¦çºè¡¨ããããã¤ãºã§ãã *11
ãã£ã¶ã¨ä¹±æ°ã®ä¸éã®ãããªæ§è³ªãæã£ã¦ããã Temporal Anti Aliasing (TAA) ãªã©ã«ç¨ããã¨ããçµæãå¾ãããããã§ãã
ä¹±æ°ã¨ãããããã£ã¶ã£ã½ãã§ãããããã¯ããã
key | value |
---|---|
Instruction Mix | 10 |
GPU Duration | 26.62 μs |
FPS | 2632 |
PractRand Failed | 216 |
ãã¡ãããã¹ãã«ã¯è½ã¡ã¦ãã¾ããããã¾ã§ããã£ã¶ç¨ã§ãã£ã¦ä¹±æ°ã§ã¯ãªãã¨ãããã¨ã§ãããã
IQ's Integer Hash 1
uint iqint1_orig(uint n) { n ^= n << 13; return n * (n * n * 15731 + 789221) + 1376312589; } float iqint1(float4 pos) { return iqint1_orig(uint(pos.x) + iqint1_orig(uint(pos.y) + iqint1_orig(uint(pos.z) + iqint1_orig(uint(pos.w))))) * 2.3283064365386962890625e-10; }
iq æ°ã 2017 å¹´ã« Shadertoy ä¸ã§å ¬éããããã·ã¥é¢æ°ã§ãã *12
ã¡ãªã¿ã«ããªãªã¸ãã«ã®ã½ã¼ã¹ã³ã¼ãã«ã¯ä»¥ä¸ã®ããã«è¨ããã¦ãã¾ãã
Do NOT use this hash as a random number generator.
ç¹ã«ãã¿ã¼ã³ã¯è¦ããããæ¦ãè¯å¥½ã§ããã
key | value |
---|---|
Instruction Mix | 30 |
GPU Duration | 28.67 μs |
FPS | 2630 |
PractRand Failed | 217 |
ããããã¹ãã«ã¯è½ã¡ã¦ãã¾ã£ã¦ãã¾ãã
license
// The MIT License
// Copyright © 2017 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
IQ's Integer Hash 2
uint3 iqint2_orig(uint3 x) { uint k = 1103515245; x = ((x >> 8) ^ x.yzx) * k; x = ((x >> 8) ^ x.yzx) * k; x = ((x >> 8) ^ x.yzx) * k; return x; } float iqint2(float4 pos) { return (dot(iqint2_orig(pos.xyz), 1) + dot(iqint2_orig(pos.w), 1)) * 2.3283064365386962890625e-10; }
åããã iq æ°ã 2017 å¹´ã« Shadertoy ä¸ã§å ¬éããããã·ã¥é¢æ°ã§ãã *13
ãã¡ããç¹ã«ãã¿ã¼ã³ã¯è¦ããã¾ããããåªç§ããã§ãã
key | value |
---|---|
Instruction Mix | 42 |
GPU Duration | 26.62 μs |
FPS | 2622 |
PractRand Failed | 242 |
å®éã«ãã¹ãã«ãéã£ã¦ãã¾ãã
license
// The MIT License
// Copyright © 2017 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
IQ's Integer Hash 3
uint iqint3_orig(uint2 x) { uint2 q = 1103515245 * ((x >> 1) ^ x.yx); uint n = 1103515245 * (q.x ^ (q.y >> 3)); return n; } float iqint3(float4 pos) { uint value = iqint3_orig(pos.xy) + iqint3_orig(pos.zw); return value * 2.3283064365386962890625e-10; }
ãããåããã iq æ°ã 2017 å¹´ã« Shadertoy ä¸ã§å ¬éããããã·ã¥é¢æ°ã§ãã *14
ãããã±ã£ã¨è¦ã¯ãã¿ã¼ã³ããªããããããã§ããã
key | value |
---|---|
Instruction Mix | 24 |
GPU Duration | 27.65 μs |
FPS | 2580 |
PractRand Failed | 216 |
ãããããã¹ãã«ã¯å³åº§ã«è½ã¡ã¦ãã¾ãã¾ãããéããããããªãâ¦â¦
ãã ãã 2024 å¹´ã«æ´æ°ãããããããç¾å¨ã¯ä»¥ä¸ã®ã¢ã«ã´ãªãºã ã«ç½®ãæãã£ã¦ãã¾ãã
å¾æ¥ã®ã¢ã«ã´ãªãºã 㯠https://www.shadertoy.com/view/XlGcRh ããåç
§ãããã¨ãã§ãã¾ãã
uint iqint32_orig(uint2 p) { p *= uint2(73333, 7777); p ^= uint2(3333777777, 3333777777) >> (p >> 28); uint n = p.x * p.y; return n ^ n >> 15; } float iqint32(float4 pos) { uint value = iqint32_orig(pos.xy) + iqint32_orig(pos.zw); return value * 2.3283064365386962890625e-10; }
ãããã±ã£ã¨è¦ã¯å¤§ä¸å¤«ããã§ããâ¦â¦
key | value |
---|---|
Instruction Mix | 34 |
GPU Duration | 27.65 μs |
FPS | 2728 |
PractRand Failed | 218 |
ããããã¹ãã«ã¯è½ã¡ã¦ãã¾ãã¾ãããæ¹è¯åã«æ¯ã¹ãã°é·çããã¦ããã®ã§ãæ¹è¯ã¯ããã¦ããããã§ããã
license
// The MIT License
// Copyright © 2017,2024 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
JKISS32
uint jkiss32_orig(uint2 p) { uint x = p.x, y = p.y; uint z = 345678912, w = 456789123, c = 0; int t; y ^= y << 5; y ^= y >> 7; y ^= y << 22; t = int(z + w + c); z = w; c = uint(t < 0); w = uint(t & 2147483647); x += 1411392427; return x + y + w; } float jkiss32(float4 p) { return (jkiss32_orig(p.xy) + jkiss32_orig(p.zw)) * 2.3283064365386962890625e-10; }
JKISS32 ã¯ã 2010 å¹´ã« David Jones æ°ãå ¬éããä¹±æ°ã®ãã¹ããã©ã¯ãã£ã¹éã«è¼ã£ã¦ããã¢ã«ã´ãªãºã ã§ãã *15
ãã¨ã㨠George Marsaglia 大å çã® KISS æ¬ä¼¼ä¹±æ°çæå¨ *16 ããã£ã¦ããããæ¹è¯ãããã®ã ããã§ãã
ä¹ç®ã使ããã«è¨ç®ã§ããå©ç¹ãããã¨ã®ãã¨ã§ãã
ãªãããã¨ãã¨ã¯ x, y, z, w, c
ãå
é¨ç¶æ
(state) ã¨ãªã£ã¦ãããã®ãã·ã§ã¼ãã¼ç¨ã«æ¹é ãã模æ§ã§ãã
è¦ãããã«ãã¡ã§ãã
x
ãã»ã¼ç´ éãã«ãªãè¨è¨ä¸ã横ç¸ã«ãªã£ã¦ãã¾ãããã§ãã
key | value |
---|---|
Instruction Mix | 15 |
GPU Duration | 26.62 μs |
FPS | 2687 |
PractRand Failed | Ã |
è«å¤ãªã®ã§ãã¹ãã¯ãã¦ãã¾ããã
LCG
uint lcg_orig(uint p) { return p * 1664525 + 1013904223; } float lcg(float4 v) { return (lcg_orig(lcg_orig(lcg_orig(lcg_orig(uint(v.x)) + uint(v.y)) + uint(v.z)) + uint(v.w))) * 2.3283064365386962890625e-10; }
è¨ããã¨ç¥ããç·å½¢ååæ³ã§ãããã®å®æ°ã¯ Numerical Recipes ã«ãããã®ã§ãã *17
ã¯ã£ããã¨ãã¿ã¼ã³ãè¦ãã¾ããã
key | value |
---|---|
Instruction Mix | 14 |
GPU Duration | 27.65 μs |
FPS | 2695 |
PractRand Failed | 216 |
å½ç¶ãã¹ãã«ãå³åº§ã«è½ã¡ã¦ãã¾ãã
MD5
uint F(uint3 v) { return (v.x & v.y) | (~v.x & v.z); } uint G(uint3 v) { return (v.x & v.z) | (v.y & ~v.z); } uint H(uint3 v) { return v.x ^ v.y ^ v.z; } uint I(uint3 v) { return v.y ^ (v.x | ~v.z); } void FF(inout uint4 v, inout uint4 rotate, uint x, uint ac) { v.x = v.y + rotl(v.x + F(v.yzw) + x + ac, rotate.x); rotate = rotate.yzwx; v = v.yzwx; } void GG(inout uint4 v, inout uint4 rotate, uint x, uint ac) { v.x = v.y + rotl(v.x + G(v.yzw) + x + ac, rotate.x); rotate = rotate.yzwx; v = v.yzwx; } void HH(inout uint4 v, inout uint4 rotate, uint x, uint ac) { v.x = v.y + rotl(v.x + H(v.yzw) + x + ac, rotate.x); rotate = rotate.yzwx; v = v.yzwx; } void II(inout uint4 v, inout uint4 rotate, uint x, uint ac) { v.x = v.y + rotl(v.x + I(v.yzw) + x + ac, rotate.x); rotate = rotate.yzwx; v = v.yzwx; } uint K(uint i) { return uint(abs(sin(float(i) + 1.0)) * float(0xffffffff)); } uint4 md5_orig(uint4 u) { uint4 digest = uint4(0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476); uint4 r, v = digest; uint i = 0; uint m[16]; m[0] = u.x; m[1] = u.y; m[2] = u.z; m[3] = u.w; m[4] = 0; m[5] = 0; m[6] = 0; m[7] = 0; m[8] = 0; m[9] = 0; m[10] = 0; m[11] = 0; m[12] = 0; m[13] = 0; m[14] = 0; m[15] = 0; r = uint4(7, 12, 17, 22); FF(v, r, m[0], K(i++)); FF(v, r, m[1], K(i++)); FF(v, r, m[2], K(i++)); FF(v, r, m[3], K(i++)); FF(v, r, m[4], K(i++)); FF(v, r, m[5], K(i++)); FF(v, r, m[6], K(i++)); FF(v, r, m[7], K(i++)); FF(v, r, m[8], K(i++)); FF(v, r, m[9], K(i++)); FF(v, r, m[10], K(i++)); FF(v, r, m[11], K(i++)); FF(v, r, m[12], K(i++)); FF(v, r, m[13], K(i++)); FF(v, r, m[14], K(i++)); FF(v, r, m[15], K(i++)); r = uint4(5, 9, 14, 20); GG(v, r, m[1], K(i++)); GG(v, r, m[6], K(i++)); GG(v, r, m[11], K(i++)); GG(v, r, m[0], K(i++)); GG(v, r, m[5], K(i++)); GG(v, r, m[10], K(i++)); GG(v, r, m[15], K(i++)); GG(v, r, m[4], K(i++)); GG(v, r, m[9], K(i++)); GG(v, r, m[14], K(i++)); GG(v, r, m[3], K(i++)); GG(v, r, m[8], K(i++)); GG(v, r, m[13], K(i++)); GG(v, r, m[2], K(i++)); GG(v, r, m[7], K(i++)); GG(v, r, m[12], K(i++)); r = uint4(4, 11, 16, 23); HH(v, r, m[5], K(i++)); HH(v, r, m[8], K(i++)); HH(v, r, m[11], K(i++)); HH(v, r, m[14], K(i++)); HH(v, r, m[1], K(i++)); HH(v, r, m[4], K(i++)); HH(v, r, m[7], K(i++)); HH(v, r, m[10], K(i++)); HH(v, r, m[13], K(i++)); HH(v, r, m[0], K(i++)); HH(v, r, m[3], K(i++)); HH(v, r, m[6], K(i++)); HH(v, r, m[9], K(i++)); HH(v, r, m[12], K(i++)); HH(v, r, m[15], K(i++)); HH(v, r, m[2], K(i++)); r = uint4(6, 10, 15, 21); II(v, r, m[0], K(i++)); II(v, r, m[7], K(i++)); II(v, r, m[14], K(i++)); II(v, r, m[5], K(i++)); II(v, r, m[12], K(i++)); II(v, r, m[3], K(i++)); II(v, r, m[10], K(i++)); II(v, r, m[1], K(i++)); II(v, r, m[8], K(i++)); II(v, r, m[15], K(i++)); II(v, r, m[6], K(i++)); II(v, r, m[13], K(i++)); II(v, r, m[4], K(i++)); II(v, r, m[11], K(i++)); II(v, r, m[2], K(i++)); II(v, r, m[9], K(i++)); return digest + v; } float md5(float4 v) { uint4 result = md5_orig(v); return dot(result, 1) * 2.3283064365386962890625e-10; }
æå·è«çããã·ã¥é¢æ°ã§ãã (ã¨ç¾å¨è¨ã£ã¦ãããã©ããã¯è«¸èª¬ããã¾ãã) MD5 *18 ãã·ã§ã¼ãã¼ç¨ã«æ¹é ãããã®ã§ãã *19
ãããã«å¤§ä¸å¤«ããã§ãã綺éºãªãã¯ã¤ããã¤ãºã§ããã
key | value |
---|---|
Instruction Mix | 227 |
GPU Duration | 78.85 μs |
FPS | 2748 |
PractRand Failed | > 238 |
ãã¡ãããçµ±è¨çãªæ¤å®ã¯ãã¹ã§ãã¾ãã
ãã ããããã«éãããã¡ããã¡ãæéããããããã ã£ãã®ã§éä¸ã§æ¢ãã¦ãã¾ãã¾ããã
è
ã£ã¦ãæå·è«çããã·ã¥é¢æ°ãªã®ã§å¤§ä¸å¤«ã ã¨æãã¾ããå¤åã
MurmurHash3
uint fmix32(uint h) { h ^= h >> 16; h *= 0x85ebca6b; h ^= h >> 13; h *= 0xc2b2ae35; h ^= h >> 16; return h; } uint murmur34_orig(uint4 seed) { uint c1 = 0xcc9e2d51, c2 = 0x1b873593; uint h = 0; uint k = seed.x; k *= c1; k = rotl(k, 15); k *= c2; h ^= k; h = rotl(h, 13); h = h * 5 + 0xe6546b64; k = seed.y; k *= c1; k = rotl(k, 15); k *= c2; h ^= k; h = rotl(h, 13); h = h * 5 + 0xe6546b64; k = seed.z; k *= c1; k = rotl(k, 15); k *= c2; h ^= k; h = rotl(h, 13); h = h * 5 + 0xe6546b64; k = seed.w; k *= c1; k = rotl(k, 15); k *= c2; h ^= k; h = rotl(h, 13); h = h * 5 + 0xe6546b64; h ^= 16; return fmix32(h); } float murmur34(float4 v) { return murmur34_orig(v) * 2.3283064365386962890625e-10; }
MurmurHash3 ã¯ãããã·ã¥é¢æ°ã®ãã¹ãã¹ã¤ã¼ãã§ãã SMHasher å
ã«å®è£
ããã¦ããããã·ã¥é¢æ°ã§ãã
æå·è«çã§ã¯ãªãã§ããããã®ã¶ãé度çã«ãå質çã«ãæ§è½ãè¯ããã¨ã§æåã§ããã
ä»åã¯ã 32bit ãã¼ã¹ã®å®è£
ã§ãã MurmurHash3_x86_32
ã使ãã¾ãã
大ä¸å¤«ããã§ããã綺éºãªãã¯ã¤ããã¤ãºã§ãã
key | value |
---|---|
Instruction Mix | 43 |
GPU Duration | 39.94 μs |
FPS | 2683 |
PractRand Failed | 241 |
ãã¹ããåé¡ãªãã TiB ã®å£ãçªç ´ãã¾ããã
PCG
uint pcg_orig(uint v) { uint state = v * 747796405 + 2891336453; uint word = ((state >> ((state >> 28) + 4)) ^ state) * 277803737; return word ^ word >> 22; } float pcg(float4 v) { return pcg_orig(pcg_orig(pcg_orig(pcg_orig(uint(v.x)) + uint(v.y)) + uint(v.z)) + uint(v.w)) * 2.3283064365386962890625e-10; }
PCG ã¯ã 2014 å¹´ã« O'neill æ°ã«ãã£ã¦éçºãããæ¬ä¼¼ä¹±æ°çæå¨ã§ãã *20
ç°¡åã« PCG ã«ã¤ãã¦èª¬æããã¨ããã®æåãªç·å½¢ååæ³ã«ç¹æ®ãªåºåé¢æ°ããã¾ãããã¨ã§å質ãåä¸ããã¤ã¤ãå é¨çè«ãæãããªç·å½¢ååæ³ã®ã¡ãªãã (ã¸ã£ã³ãã使ãããªã©) ãå¾ããã¨ãã§ããã¨ããä¸æ両å¾ãªæ¬ä¼¼ä¹±æ°çæå¨ã§ãã
PCG ã«ã¯ããªã¢ã³ããããããããã¾ãããä¸ã§ã pcg_oneseq_32_rxs_m_xs_32_random_r
ã使ãã¾ãã
è¦ããã«ã
- å é¨ç¶æ 32 bit
- åä¸ã·ã¼ã±ã³ã¹
- åºåé¢æ°ã
rxs_m_xs_32
- rightshift - xorshift - multiply - xorshift 32bit ã®æ
ã¨ããæå³ã§ãã
key | value |
---|---|
Instruction Mix | 38 |
GPU Duration | 29.70 μs |
FPS | 2704 |
PractRand Failed | 238 |
ãã¹ãã«ã¯å¤±æãã¦ãã¾ããã大å¥éãã¦ãã¾ãã
ãããæ¬æ¥ã¯æ¬ä¼¼ä¹±æ°çæå¨ãªã®ã§ãããã§ãã
åºåé¢æ°ã«éããç½®ãã¦ããã®ãåãå¥ãã¦ããæãã§ããã
PCG2D
uint2 pcg2d_orig(uint2 v) { v = v * 1664525 + 1013904223; v.x += v.y * 1664525; v.y += v.x * 1664525; v = v ^ v >> 16; v.x += v.y * 1664525; v.y += v.x * 1664525; v = v ^ v >> 16; return v; } float pcg2d(float4 v) { return (dot(pcg2d_orig(uint2(v.xy)), 1) + dot(pcg2d_orig(uint2(v.zw)), 1)) * 2.3283064365386962890625e-10; }
ããã¯ã 2020 å¹´ã« Mark Jarzynski æ°ããè¨è¨ããããã·ã¥é¢æ°ã§ãã *21
ååã®éã PCG ãè¨è¨ã®ã³ã³ã»ããã¨ãã¦ãã¾ããããã®å®æ
ã¯å¤§ããç°ãªããããã·ã¥é¢æ°ã¨ãªã£ã¦ãã¾ãã
key | value |
---|---|
Instruction Mix | 37 |
GPU Duration | 27.65 μs |
FPS | 2664 |
PractRand Failed | 227 |
è¦ãç®ã¯å¤§ä¸å¤«ããã§ããããã¹ãã«ã¯å¤±æãã¦ãã¾ãã
PCG3D
uint3 pcg3d_orig(uint3 v) { v = v * 1664525 + 1013904223; v.x += v.y * v.z; v.y += v.z * v.x; v.z += v.x * v.y; v = v ^ v >> 16; v.x += v.y * v.z; v.y += v.z * v.x; v.z += v.x * v.y; return v; } float pcg3d(float4 v) { return (dot(pcg3d_orig(v.xyz), 1) + dot(pcg3d_orig(v.w), 1)) * 2.3283064365386962890625e-10; }
ãããåããã PCG ã«ã¤ã³ã¹ãã¤ã¢ããã¦è¨è¨ãããããã·ã¥é¢æ°ã§ãã
Unreal Engine ãå
¸æ ãããã§ãã
3 å
¥å 3 åºåãããªãã£ãã®ã§ãç¡çãã 4 å
¥å 1 åºåã«æ¡å¼µãã¾ããã
key | value |
---|---|
Instruction Mix | 38 |
GPU Duration | 28.67 μs |
FPS | 2700 |
PractRand Failed | 242 |
æ¯è¼ç軽éã§ããã¹ãã«éã£ã¦ãã¾ãã
PCG3D16
uint3 pcg3d16_orig(uint3 v) { v = v * 12829 + 47989; v.x += v.y * v.z; v.y += v.z * v.x; v.z += v.x * v.y; v.x += v.y * v.z; v.y += v.z * v.x; v.z += v.x * v.y; v >>= 16; return v; } float pcg3d16(float4 v) { uint3 a = pcg3d16_orig(v.xyz); uint3 b = pcg3d16_orig(float3(v.w, 0, 0)); return ((dot(a, 1) + dot(b, 1)) & 65535) * 1.52587890625e-5; }
PCG3D ã®ç·å½¢ååæ³ã®å®æ°ã 16 ãããã«ãã¦ãåºåã 16 ãããã«çµã£ããã¼ã¸ã§ã³ã§ãã
ããã 3 å
¥å 3 åºåãããªãã£ãã®ã§ç¡çç¢çæ¡å¼µãã¾ããã
key | value |
---|---|
Instruction Mix | 30 |
GPU Duration | 27.65 μs |
FPS | 2706 |
PractRand Failed | 225 |
è¦ãç®ã¯åé¡ãªãããã§ããããã¹ãçµæã«ããã°å質ã¯è½ã¡ã¦ãã¾ã£ã¦ãã¾ãã
PCG4D
uint4 pcg4d_orig(uint4 v) { v = v * 1664525 + 1013904223; v.x += v.y * v.w; v.y += v.z * v.x; v.z += v.x * v.y; v.w += v.y * v.z; v = v ^ v >> 16; v.x += v.y * v.w; v.y += v.z * v.x; v.z += v.x * v.y; v.w += v.y * v.z; return v; } float pcg4d(float4 v) { uint4 a = pcg4d_orig(v); return dot(a, 1) * 2.3283064365386962890625e-10; }
ããã¯ã PCG2D ã¨åãã 2020 å¹´ã« Mark Jarzynski æ°ããè¨è¨ããããã·ã¥é¢æ°ã§ãã *22
key | value |
---|---|
Instruction Mix | 29 |
GPU Duration | 27.65 μs |
FPS | 2652 |
PractRand Failed | 242 |
ãããªãã«éããã㤠TiB ã®å£ãè¶ ããé å¥æ§ã示ãã¦ãã¾ãã
Pseudo
float pseudo_orig(float2 v) { v = frac(v / 128.0) * 128.0 + float2(-64.340622, -72.465622); return frac(dot(v.xyx * v.xyy, float3(20.390625, 60.703125, 2.4281209))); } float pseudo(float4 v) { return pseudo_orig(v.xy + v.zw); }
ããã Unreal Engine ãå ¸æ ãããã§ãã
key | value |
---|---|
Instruction Mix | 20 |
GPU Duration | 27.65 μs |
FPS | 2605 |
PractRand Failed | 216 |
åºåã«ããã¿ã¼ã³ãè¦ããæ°ããã¾ããã
æ¡ã®å®ãã¹ãã«ãè½ã¡ã¦ãã¾ãã
Ranlim32
uint ranlim32_orig(uint j) { uint u, v, w1, w2, x, y; v = 2244614371; w1 = 521288629; w2 = 362436069; u = j ^ v; u = u * 2891336453 + 1640531513; v ^= v >> 13; v ^= v << 17; v ^= v >> 5; w1 = 33378 * (w1 & 0xffff) + (w1 >> 16); w2 = 57225 * (w2 & 0xffff) + (w2 >> 16); v = u; u = u * 2891336453 + 1640531513; v ^= v >> 13; v ^= v << 17; v ^= v >> 5; w1 = 33378 * (w1 & 0xffff) + (w1 >> 16); w2 = 57225 * (w2 & 0xffff) + (w2 >> 16); x = u ^ u << 9; x ^= x >> 17; x ^= x << 6; y = w1 ^ w1 << 17; y ^= y >> 15; y ^= y << 5; return (x + v) ^ (y + w2); } float ranlim32(float4 v) { return ranlim32_orig(ranlim32_orig(ranlim32_orig(ranlim32_orig(uint(v.x)) + uint(v.y)) + uint(v.z)) + uint(v.w)) * 2.3283064365386962890625e-10; }
Ranlim32
㯠Numerical Recipes 3rd edition ã«è¨è¼ããã¦ãã¾ãã *23
ãªããã¨ã«ããå ¨é¨ä¹ãã¿ãããªæãã§ãããç·å½¢ååæ³ã Xorshift ãªã©ã®è¦ç´ ãå«ã¾ãã¦ãã¾ãã
key | value |
---|---|
Instruction Mix | 79 |
GPU Duration | 27.65 μs |
FPS | 2595 |
PractRand Failed | 228 |
è¦ãç®ä¸ã¯åé¡ããã¾ãããããã¹ãã«è½ã¡ã¦ãã¾ãã
ä»ã®ããã·ã¥é¢æ°ã¨æ¯ã¹ãã¨çµæ§éãã®ã§å³ããã¨ããã
Superfast
uint superfast4_orig(uint4 data) { uint hash = 8, tmp; hash += data.x & 0xffff; tmp = (((data.x >> 16) & 0xffff) << 11) ^ hash; hash = hash << 16 ^ tmp; hash += hash >> 11; hash += data.y & 0xffff; tmp = (((data.y >> 16) & 0xffff) << 11) ^ hash; hash = hash << 16 ^ tmp; hash += hash >> 11; hash += data.z & 0xffff; tmp = (((data.z >> 16) & 0xffff) << 11) ^ hash; hash = hash << 16 ^ tmp; hash += hash >> 11; hash += data.w & 0xffff; tmp = (((data.w >> 16) & 0xffff) << 11) ^ hash; hash = hash << 16 ^ tmp; hash += hash >> 11; hash ^= hash << 3; hash += hash >> 5; hash ^= hash << 4; hash += hash >> 17; hash ^= hash << 25; hash += hash >> 6; return hash; } float superfast4(float4 v) { return superfast4_orig(v) * 2.3283064365386962890625e-10; }
Superfast
ã¯ã Paul Hsieh æ°ã«ãã£ã¦éçºãããããã·ã¥é¢æ°ã§ãã *24
CPU ã«ããã¦ã¯ CRC32 ã FNV ã«æ¯ã¹ã¦é«éã«å®è¡ã§ãããããã§ãã
ç¾ä»£ã«ããã¦ã¯ã¡ãã£ã¨å½ä»¤æ°ãå¤ãã«è¦ãã¾ããæããã¦â¦â¦ï¼
key | value |
---|---|
Instruction Mix | 43 |
GPU Duration | 26.62 μs |
FPS | 2636 |
PractRand Failed | 219 |
è¦ãç®ä¸ã¯åé¡ãªãããã«è¦ãã¾ããããã¹ãã«è½ã¡ã¦ãã¾ã£ã¦ãã¾ãã
TEA
uint2 scrambleTea(uint2 v, int rounds) { uint y = v.x; uint z = v.y; uint sum = 0; for (int i = 0; i < rounds; i++) { sum += 0x9e3779b9; y += ((z << 4) + 0xa341316c) ^ (z + sum) ^ ((z >> 5) + 0xc8013ea4); z += ((y << 4) + 0xad90777d) ^ (y + sum) ^ ((y >> 5) + 0x7e95761e); } return uint2(y, z); } float tea4(float4 v) { return dot(scrambleTea(v.xy, 4) + scrambleTea(v.zw, 4), 1) * 2.3283064365386962890625e-10; }
TEA (Tiny Encription Algorithm) ã¯ã軽éãªãããã¯æå·ã¢ã«ã´ãªãºã ã§ãã *25
ã©ã¦ã³ãæ°ãæå®ã§ãã¾ãããªãªã¸ãã«ã§ã¯ 32 ã ã£ãããã§ãããéãããã®ã§ä»å㯠4 ã¨ãã¾ãã
key | value |
---|---|
Instruction Mix | 87 |
GPU Duration | 29.70 μs |
FPS | 2626 |
PractRand Failed | 221 |
ç¹ç©ã®ãããªæ¨¡æ§ãè¦ãã¾ããã
ãã¹ãã«ãè½ã¡ã¦ãã¾ãã
Trig
float trig_orig(float2 pos) { return frac(sin(dot(pos, float2(12.9898, 78.233))) * 43758.5453123); } float trig(float4 pos) { return frac(sin(dot(pos, float4(12.9898, 78.233, 42.234, 25.3589))) * 43758.5453123); }
æåãªã¯ã³ã©ã¤ãã¼ä¹±æ°ã§ãã
ååã¯ãã¶ã Trigonometric functions (ä¸è§é¢æ°) ãããã¦ãã¾ãã
ãã® The Book of Shaders ã«ãè¼ã£ã¦ãã¾ãã
ã³ã¼ããå®æ°ã§ã°ã°ãã°å¤æ°ã®ä½¿ç¨ä¾ãåºã¦ãã¾ããä¾ãã°ã Unity ã® ShaderGraph ã® Random Range ãã¼ã ã§ããã®å®è£ ã使ããã¦ãã¾ãã
å©ç¹ã¨ãã¦ã¯ãå®è£
ãç°¡åãªãã¨ãæãããã¾ãã
æ¬ ç¹ã¨ãã¦ã¯ãä¸è§é¢æ°ãå©ç¨ãã¦ããããç°ãªãç°å¢ä¸ã§åç¾æ§ããªããã¨ãæ¡å¤ãããããããã¿ã¼ã³ããããã¨ãæãããã¾ãã
key | value |
---|---|
Instruction Mix | 11 |
GPU Duration | 27.65 μs |
FPS | 2639 |
PractRand Failed | 216 |
ç¹å¾´çãªç¸æ¨¡æ§ã«ãªã£ã¦ããããã¹ãã«ãå³åº§ã«è½ã¡ã¦ãã¾ãã
Wang
uint wang_orig(uint v) { v = (v ^ 61) ^ (v >> 16); v *= 9; v ^= v >> 4; v *= 0x27d4eb2d; v ^= v >> 15; return v; } float wang(float4 v) { return wang_orig(wang_orig(wang_orig(wang_orig(uint(v.x)) + uint(v.y)) + uint(v.z)) + uint(v.w))* 2.3283064365386962890625e-10; }
Wang
ã¯ã Thomas Wang æ°ã 1997 å¹´ã«çºè¡¨ããããã·ã¥é¢æ°ã§ãã *26
key | value |
---|---|
Instruction Mix | 41 |
GPU Duration | 27.65 μs |
FPS | 2639 |
PractRand Failed | 235 |
å¥éãã¾ãããããã¹ãçµæ㯠1 TiB ã«ã¯å±ãã¾ããã§ããã
Xorshift128
uint4 xorshift128_orig(uint4 v) { v.w ^= v.w << 11; v.w ^= v.w >> 8; v = v.wxyz; v.x ^= v.y; v.x ^= v.y >> 19; return v; } float xorshift128(float4 v) { uint4 vv = xorshift128_orig(uint4(v)); return dot(vv, 1) * 2.3283064365386962890625e-10; }
Xorshift128
ã¯ã George Marsaglia æ°ã 2003 å¹´ã«çºè¡¨ããæ¬ä¼¼ä¹±æ°çæå¨ã§ãã *27
æ¬æ¥ã¯æ¬ä¼¼ä¹±æ°çæå¨ãªã®ã§ã v.y, v.z
㯠v.x, v.y
ãã®ã¾ã¾ã«ãªã£ã¦ãããªã©ãããã·ã¥é¢æ°ã«ããã«ã¯è¥å¹²æªããã¨ãããããã¾ãã
æ¡ã®å®ã§ããã
key | value |
---|---|
Instruction Mix | 10 |
GPU Duration | 26.62 μs |
FPS | 2601 |
PractRand Failed | Ã |
è«å¤ãªã®ã§ãã¹ããã¦ãã¾ããã
Xorshift32
uint xorshift32_orig(uint v) { v ^= v << 13; v ^= v >> 17; v ^= v << 5; return v; } float xorshift32(float4 v) { return xorshift32_orig(xorshift32_orig(xorshift32_orig(xorshift32_orig(uint(v.x)) + uint(v.y)) + uint(v.z)) + uint(v.w)) * 2.3283064365386962890625e-10; }
Xorshift32
ã¯ãåãã George Marsaglia æ°ã 2003 å¹´ã«çºè¡¨ããæ¬ä¼¼ä¹±æ°çæå¨ã§ãã *28
ããã¯ååããã·ã¥é¢æ°ã®ãããªè¨è¨ã«ãªã£ã¦ããã®ã§ã xorshift128
ããã¯ããæ績ã«ãªãããã§ããâ¦â¦
key | value |
---|---|
Instruction Mix | 33 |
GPU Duration | 30.72 μs |
FPS | 2601 |
PractRand Failed | 216 |
ããæ³¢ã®ãããªæ¨¡æ§ãããã¾ããã
æ®å¿µãªãããã¹ãã«ãå³åº§ã«è½ã¡ã¦ãã¾ã£ã¦ãã¾ãã
xxHash32
uint xxhash_orig(uint4 value) { uint XXH_PRIME32_1 = 0x9E3779B1; uint XXH_PRIME32_2 = 0x85EBCA77; uint XXH_PRIME32_3 = 0xC2B2AE3D; uint4 state = uint4(XXH_PRIME32_1 + XXH_PRIME32_2, XXH_PRIME32_2, 0, -XXH_PRIME32_1); state += value * XXH_PRIME32_2; state = rotl(state, 13); state *= XXH_PRIME32_1; uint h32 = rotl(state[0], 1) + rotl(state[1], 7) + rotl(state[2], 12) + rotl(state[3], 18); h32 += 16; h32 ^= h32 >> 15; h32 *= XXH_PRIME32_2; h32 ^= h32 >> 13; h32 *= XXH_PRIME32_3; h32 ^= h32 >> 16; return h32; } float xxhash(float4 v) { return xxhash_orig(v) * 2.3283064365386962890625e-10; }
xxHash ã¯ã軽éãªéæå·è«çããã·ã¥é¢æ°ã§ãã *29
ä»åã¯ãã®ä¸ã§ã 32bit ãã¼ã¹ã® xxHash32
ãç¨ãã¾ãã
key | value |
---|---|
Instruction Mix | 42 |
GPU Duration | 27.65 μs |
FPS | 2676 |
PractRand Failed | 227 |
è¦ãç®ä¸ã¯åé¡ãªãããã§ããããã¹ãã«ã¯è½ã¡ã¦ãã¾ãã¾ãããæå¤ã§ãã
license
xxHash Library
Copyright (c) 2012-2021 Yann Collet
All rights reserved.
BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php)
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Wyhash
uint2 mul64(uint a, uint b) { uint alo = a & 0xffff, ahi = a >> 16; uint blo = b & 0xffff, bhi = b >> 16; uint lo = alo * blo; uint mid1 = ahi * blo; uint mid2 = alo * bhi; uint hi = ahi * bhi; return uint2( lo + (mid1 << 16) + (mid2 << 16), hi + (mid1 >> 16) + (mid2 >> 16) + (((mid1 & 0xffff) + (mid2 & 0xffff) + (lo >> 16)) >> 16)); } void wymix32(inout uint a, inout uint b) { uint2 c = uint2(a ^ 0x53c5ca59u, 0); c = mul64(c.x, b ^ 0x74743c1b); a = c.x; b = c.y; } uint wyhash_orig(float4 value, uint seed) { uint see1 = 16; wymix32(seed, see1); seed ^= uint(value.x); see1 ^= uint(value.y); wymix32(seed, see1); seed ^= uint(value.z); see1 ^= uint(value.w); wymix32(seed, see1); wymix32(seed, see1); wymix32(seed, see1); return seed ^ see1; } float wyhash(float4 v) { return wyhash_orig(v, 0xa0b428db) * 2.3283064365386962890625e-10; }
Wyhash ã¯ã wangyi-fudan æ°ã«ãã£ã¦ 2019 å¹´ã«éçºãããé«éãªããã·ã¥é¢æ°ã§ãã *30
2 åé·ä¹ç® (32bit x 32bit -> 64bit) ããã¾ã使ã£ã¦ããããã·ã¥é¢æ°ã§ãã
CPU ãªããã®ä¹ç®ã¯å°ç¨å½ä»¤ããã£ã¦ããã§ããã®ã§ãããã·ã§ã¼ãã¼ä¸ã§ã¯ intrinsics ãåå¨ããªãã®ã§çç®æ³ã§è§£ãã¾ããã
ãªããåã GPU ã§ã OpenGL (GLSL) ã«ã¯ umulExtended() é¢æ°ãããã 2 åé·ä¹ç®ãä¸çºã§è¨ç®ã§ãããããã§ãããããã¾ããã
HLSL ã§ã¯ ã¾ã æ¤è¨æ®µéããã ã§ãã
2 åé·ä¹ç®ããããã« Karatsuba æ³ ã§å®è£
ãã¦ã¿ãããããé
ããªã£ããã¨ããæ²ããäºä»¶ãããã¾ãããããã«ä¾é¤ãã¦ããã¾ãã
// csharp karatsuba multiplication public static (uint lo, uint hi) mulhi(uint a, uint b) { uint alo = a & 0xffff, ahi = a >> 16; uint blo = b & 0xffff, bhi = b >> 16; uint hihi = ahi * bhi; uint lolo = alo * blo; uint aa = alo - ahi; uint bb = bhi - blo; uint mid = aa * bb; uint midSign = (mid != 0 && ((aa ^ bb) >> 31) != 0) ? 1u : 0u; uint lo = lolo + (mid << 16) + (lolo << 16) + (hihi << 16); uint carry = (lolo >> 16) + (mid & 0xffff) + (lolo & 0xffff) + (hihi & 0xffff); uint hi = hihi + (mid >> 16) + (lolo >> 16) + (hihi >> 16) + (carry >> 16) - (midSign << 16); return (lo, hi); }
key | value |
---|---|
Instruction Mix | 87 |
GPU Duration | 28.67 μs |
FPS | 2636 |
PractRand Failed | 242 |
2 åé·ä¹ç®ã®ãããå½ä»¤æ°ã¯å¢ãã¦ãã¾ã£ã¦ãã¾ããããã¹ãã«åé¡ãªããã¹ãã¦ãã¾ãã
ãªãã wyhash ã«ã¯ rapidhash ã¨ããå¾ç¶ãããããã§ããã 64 x 64 = 128 bit ã® 2 åé·ä¹ç®ãå¿
è¦ãªããã·ã§ã¼ãã¼ã§é«å¹çã«å®è£
ããã®ã¯é£ãããã§ãã
lowbias32
uint lowbias32_orig(uint x) { x ^= x >> 16; x *= 0x7feb352d; x ^= x >> 15; x *= 0x846ca68b; x ^= x >> 16; return x; } float lowbias32(float4 v) { return lowbias32_orig(lowbias32_orig(lowbias32_orig(lowbias32_orig(uint(v.x)) + uint(v.y)) + uint(v.z)) + uint(v.w)) * 2.3283064365386962890625e-10; }
ããã¯ã Chris Wellons æ°ã«ãã£ã¦ 2018 å¹´ã«çºè¡¨ãããããã·ã¥é¢æ°ã§ãã *31
å質ã®è¯ãããã·ã¥ãæ¢ç´¢ãããã¼ã«ã«ãã£ã¦çºè¦ãããããã§ãã
key | value |
---|---|
Instruction Mix | 41 |
GPU Duration | 28.67 μs |
FPS | 2638 |
PractRand Failed | 242 |
æ¯è¼çé«éã§ããã¹ãã«ããã¹ãã¦ãã¾ãã
triple32
uint triple32_orig(uint x) { x ^= x >> 17; x *= 0xed5ad4bb; x ^= x >> 11; x *= 0xac4c1b51; x ^= x >> 15; x *= 0x31848bab; x ^= x >> 14; return x; } float triple32(float4 v) { return triple32_orig(triple32_orig(triple32_orig(triple32_orig(uint(v.x)) + uint(v.y)) + uint(v.z)) + uint(v.w)) * 2.3283064365386962890625e-10; }
ããã Chris Wellons æ°ã«ãã£ã¦ 2018 å¹´ã«çºè¡¨ãããããã·ã¥é¢æ°ã§ãã *32
lowbias32
ã«æ¯ã¹ã¦å½ä»¤æ°ãå¢ãã¦ãããã®ã®å質ãåä¸ãã¦ããããã©ã³ãã ãªç½®æ (並ã¹æ¿ã) ã¨çµ±è¨çã«åºå¥ã§ããªããã¨ã¾ã§è¨ããã¦ãã¾ãã
key | value |
---|---|
Instruction Mix | 53 |
GPU Duration | 27.65 μs |
FPS | 2603 |
PractRand Failed | 239 |
ãªãã lowbias32
ããããã¹ãçµæãæªããªã£ã¦ãã¾ããã©ããã¦ï¼
fihash
float fihash_orig(float2 v) { uint2 u = asint(v * float2(141421356, 2718281828)); return float((u.x ^ u.y) * 3141592653) * 2.3283064365386962890625e-10; } float fihash(float4 v) { return fihash_orig(v.xy + v.zw); }
2024 å¹´ã« Lumi æ°ã«ãã£ã¦ä½æãããããã·ã¥é¢æ°ã§ãã *33
key | value |
---|---|
Instruction Mix | 9 |
GPU Duration | 28.67 μs |
FPS | 2642 |
PractRand Failed | 216 |
å½ä»¤æ°ããã°æãã¦å°ãªãã§ããããã¯ããã
è¦ãç®ä¸ã¯åé¡ãªãããã§ããããã¹ãã«ã¯å³åº§ã«è½ã¡ã¦ãã¾ã£ã¦ãã¾ãã
ã¡ãªã¿ã«ã 2018 å¹´ã« James_Harnett æ°ã«ãã£ã¦ã»ã¼åãæ§é ã®ããã·ã¥é¢æ°ãææ¡ããã¦ãããã¨ã注è¨ãã¦ããã¾ãã
(ã·ã³ãã«ãªæ§é ãããã·ã³ã¯ããã·ãã£çã«çã¾ãããã®ãã¨æãã¾ãããã¶ãã)
https://www.shadertoy.com/view/MdcfDj
license
// The MIT License
// Copyright © 2024 Giorgi Azmaipharashvili
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
fast32hash
float4 fast32hash_orig(float2 v) { const float2 offset = float2(26, 161); const float domain = 71; const float someLargeFloat = 951.135664; float4 p = float4(v, v + 1); p = p - floor(p * (1.0 / domain)) * domain; p += offset.xyxy; p *= p; return frac(p.xzxz * p.yyww * (1.0 / someLargeFloat)); } float fast32hash(float4 x) { return fast32hash_orig(x.xy + x.zw).x; }
2011 å¹´ã« Brian Sharpe æ°ãçºè¡¨ããããã·ã¥é¢æ°ã§ãã *34
uint
ã使ããã«å®è£
ã§ãããããæ´æ°è¨ç®ãé
ã GPU ã§ãé«éã«å®è¡ã§ãããã¨ãæå¾
ããã¾ãã
key | value |
---|---|
Instruction Mix | 17 |
GPU Duration | 28.67 μs |
FPS | 2653 |
PractRand Failed | 216 |
æããã«ç¹°ãè¿ãã®ãã¿ã¼ã³ãè¦ãã¾ããã
ãã¹ãã«ãå³åº§ã«è½ã¡ã¦ãã¾ã£ã¦ãã¾ãã
Philox
uint4 philox_round(uint2 key, uint4 ctr) { uint2 lohi0 = mul64(ctr.x, 0xD2511F53); uint2 lohi1 = mul64(ctr.z, 0xCD9E8D57); return uint4(lohi1.y ^ ctr.y ^ key.x, lohi1.x, lohi0.y ^ ctr.w ^ key.y, lohi0.x); } uint2 philox_bumpkey(uint2 key) { return key + uint2(0x9E3779B9, 0xBB67AE85); } uint4 philox_orig(uint2 key, uint4 ctr) { ctr = philox_round(key, ctr); key = philox_bumpkey(key); ctr = philox_round(key, ctr); key = philox_bumpkey(key); ctr = philox_round(key, ctr); key = philox_bumpkey(key); ctr = philox_round(key, ctr); key = philox_bumpkey(key); ctr = philox_round(key, ctr); key = philox_bumpkey(key); ctr = philox_round(key, ctr); key = philox_bumpkey(key); ctr = philox_round(key, ctr); key = philox_bumpkey(key); ctr = philox_round(key, ctr); key = philox_bumpkey(key); ctr = philox_round(key, ctr); key = philox_bumpkey(key); ctr = philox_round(key, ctr); return ctr; } float philox(float4 v) { uint4 u = v; return philox_orig(uint2(0xf19cd101, 0x3d30), u).x * 2.3283064365386962890625e-10; }
Philox ã¯ã 2011 å¹´ã«çºè¡¨ãããæ¬ä¼¼ä¹±æ°çæå¨ã§ãã *35
ãªãã§ãã 32 bit ç°å¢ã§ã¹ã¿ã³ãã¼ã㪠Philox-4x32-10
ã使ç¨ãã¾ãããæ°å㯠4 å x 32 bit - 10 ã©ã¦ã³ãã表ãã¦ãã¾ãã
key | value |
---|---|
Instruction Mix | 294 |
GPU Duration | 62.46 μs |
FPS | 2729 |
PractRand Failed | 242 |
å½ä»¤æ°ãå¤ãåããã¹ãã¯åé¡ãªãããã§ãã
ã¡ãã£ã¨éãã®ãé£ç¹ããã
AES-CTR
static const int AesSbox[256] = { 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16, }; uint aesctr_subword(uint x) { return uint(AesSbox[x & 0xff]) ^ uint(AesSbox[(x >> 8) & 0xff]) << 8 ^ uint(AesSbox[(x >> 16) & 0xff]) << 16 ^ uint(AesSbox[x >> 24]) << 24; } uint4 aesctr_round(uint4 k, uint rcon) { //uint keygenassist0 = aesctr_subword(k1); //uint keygenassist1 = keygenassist0 >> 8 ^ keygenassist0 << 24 ^ rcon; uint keygenassist2 = aesctr_subword(k.w); uint keygenassist3 = keygenassist2 >> 8 ^ keygenassist2 << 24 ^ rcon; uint4 t = uint4( k.x, k.y ^ k.x, k.z ^ k.y ^ k.x, k.w ^ k.z ^ k.y ^ k.x); t ^= keygenassist3; return t; } uint aesctr_multiply(uint x, uint y) { uint result = 0; for (uint mask = 1; mask < 256; mask <<= 1) { if (y & mask) { result ^= x; } x = x << 1 ^ ((x & 0x80) ? 0x1b : 0); } return result; } uint4 aesctr_mixcolumns(uint4 u) { uint4 r; r.x = uint(aesctr_multiply(2, u.x & 0xff) ^ aesctr_multiply(3, ((u.x >> 8) & 0xff)) ^ ((u.x >> 16) & 0xff) ^ (u.x >> 24)) ^ uint((u.x & 0xff) ^ aesctr_multiply(2, (u.x >> 8) & 0xff) ^ aesctr_multiply(3, (u.x >> 16) & 0xff) ^ (u.x >> 24)) << 8 ^ uint((u.x & 0xff) ^ ((u.x >> 8) & 0xff) ^ aesctr_multiply(2, (u.x >> 16) & 0xff) ^ aesctr_multiply(3, (u.x >> 24))) << 16 ^ uint(aesctr_multiply(3, u.x & 0xff) ^ ((u.x >> 8) & 0xff) ^ ((u.x >> 16) & 0xff) ^ aesctr_multiply(2, (u.x >> 24))) << 24; r.y = uint(aesctr_multiply(2, u.y & 0xff) ^ aesctr_multiply(3, ((u.y >> 8) & 0xff)) ^ ((u.y >> 16) & 0xff) ^ (u.y >> 24)) ^ uint((u.y & 0xff) ^ aesctr_multiply(2, (u.y >> 8) & 0xff) ^ aesctr_multiply(3, (u.y >> 16) & 0xff) ^ (u.y >> 24)) << 8 ^ uint((u.y & 0xff) ^ ((u.y >> 8) & 0xff) ^ aesctr_multiply(2, (u.y >> 16) & 0xff) ^ aesctr_multiply(3, (u.y >> 24))) << 16 ^ uint(aesctr_multiply(3, u.y & 0xff) ^ ((u.y >> 8) & 0xff) ^ ((u.y >> 16) & 0xff) ^ aesctr_multiply(2, (u.y >> 24))) << 24; r.z = uint(aesctr_multiply(2, u.z & 0xff) ^ aesctr_multiply(3, ((u.z >> 8) & 0xff)) ^ ((u.z >> 16) & 0xff) ^ (u.z >> 24)) ^ uint((u.z & 0xff) ^ aesctr_multiply(2, (u.z >> 8) & 0xff) ^ aesctr_multiply(3, (u.z >> 16) & 0xff) ^ (u.z >> 24)) << 8 ^ uint((u.z & 0xff) ^ ((u.z >> 8) & 0xff) ^ aesctr_multiply(2, (u.z >> 16) & 0xff) ^ aesctr_multiply(3, (u.z >> 24))) << 16 ^ uint(aesctr_multiply(3, u.z & 0xff) ^ ((u.z >> 8) & 0xff) ^ ((u.z >> 16) & 0xff) ^ aesctr_multiply(2, (u.z >> 24))) << 24; r.w = uint(aesctr_multiply(2, u.w & 0xff) ^ aesctr_multiply(3, ((u.w >> 8) & 0xff)) ^ ((u.w >> 16) & 0xff) ^ (u.w >> 24)) ^ uint((u.w & 0xff) ^ aesctr_multiply(2, (u.w >> 8) & 0xff) ^ aesctr_multiply(3, (u.w >> 16) & 0xff) ^ (u.w >> 24)) << 8 ^ uint((u.w & 0xff) ^ ((u.w >> 8) & 0xff) ^ aesctr_multiply(2, (u.w >> 16) & 0xff) ^ aesctr_multiply(3, (u.w >> 24))) << 16 ^ uint(aesctr_multiply(3, u.w & 0xff) ^ ((u.w >> 8) & 0xff) ^ ((u.w >> 16) & 0xff) ^ aesctr_multiply(2, (u.w >> 24))) << 24; return r; } uint aesctr_orig(uint4 x) { uint4 seed[11]; seed[0] = x; seed[ 1] = aesctr_round(seed[0], 0x01); seed[ 2] = aesctr_round(seed[1], 0x02); seed[ 3] = aesctr_round(seed[2], 0x04); seed[ 4] = aesctr_round(seed[3], 0x08); seed[ 5] = aesctr_round(seed[4], 0x10); seed[ 6] = aesctr_round(seed[5], 0x20); seed[ 7] = aesctr_round(seed[6], 0x40); seed[ 8] = aesctr_round(seed[7], 0x80); seed[ 9] = aesctr_round(seed[8], 0x1b); seed[10] = aesctr_round(seed[9], 0x36); uint4 ctr = uint4(1, 0, 0, 0); uint4 t = ctr ^ seed[0]; for (int i = 1; i <= 9; i++) { uint4 u; u.x = ((t.x >> 0) & 0xff) << 0 ^ ((t.y >> 8) & 0xff) << 8 ^ ((t.z >> 16) & 0xff) << 16 ^ ((t.w >> 24) & 0xff) << 24; u.y = ((t.y >> 0) & 0xff) << 0 ^ ((t.z >> 8) & 0xff) << 8 ^ ((t.w >> 16) & 0xff) << 16 ^ ((t.x >> 24) & 0xff) << 24; u.z = ((t.z >> 0) & 0xff) << 0 ^ ((t.w >> 8) & 0xff) << 8 ^ ((t.x >> 16) & 0xff) << 16 ^ ((t.y >> 24) & 0xff) << 24; u.w = ((t.w >> 0) & 0xff) << 0 ^ ((t.x >> 8) & 0xff) << 8 ^ ((t.y >> 16) & 0xff) << 16 ^ ((t.z >> 24) & 0xff) << 24; u.x = aesctr_subword(u.x); u.y = aesctr_subword(u.y); u.z = aesctr_subword(u.z); u.w = aesctr_subword(u.w); u = aesctr_mixcolumns(u); t = u ^ seed[i]; } if (++ctr.x == 0) { if (++ctr.y == 0) { if (++ctr.z == 0) { ++ctr.w; } } } { uint4 u; u.x = ((t.x >> 0) & 0xff) << 0 ^ ((t.y >> 8) & 0xff) << 8 ^ ((t.z >> 16) & 0xff) << 16 ^ ((t.w >> 24) & 0xff) << 24; u.y = ((t.y >> 0) & 0xff) << 0 ^ ((t.z >> 8) & 0xff) << 8 ^ ((t.w >> 16) & 0xff) << 16 ^ ((t.x >> 24) & 0xff) << 24; u.z = ((t.z >> 0) & 0xff) << 0 ^ ((t.w >> 8) & 0xff) << 8 ^ ((t.x >> 16) & 0xff) << 16 ^ ((t.y >> 24) & 0xff) << 24; u.w = ((t.w >> 0) & 0xff) << 0 ^ ((t.x >> 8) & 0xff) << 8 ^ ((t.y >> 16) & 0xff) << 16 ^ ((t.z >> 24) & 0xff) << 24; u.x = aesctr_subword(u.x); u.y = aesctr_subword(u.y); u.z = aesctr_subword(u.z); u.w = aesctr_subword(u.w); t = u ^ seed[i]; } return t; } float aesctr(float4 v) { return aesctr_orig(uint4(asint(v.x), asint(v.y), asint(v.z), asint(v.w))) * 2.3283064365386962890625e-10f; }
AES (Advanced Encryption Standard) ã¯ã 2001 å¹´ã«ã¢ã¡ãªã«ã§æ¨æºæå·ã¨ãã¦å®ããããå ±ééµæå·ã¢ã«ã´ãªãºã ã§ãã *36
ä»å㯠CTR ã¢ã¼ããå©ç¨ãã¦å®è£
ãã¦ãã¾ãã
CPU ä¸ãªã AES-NI å°ç¨å½ä»¤ã使ãã¦ãããªãã«éãã®ã§ãããã·ã§ã¼ãã¼ä¸ã¨ãªãã¨å®å
¨ã«ã½ããã¦ã§ã¢å®è£
ãªã®ã§ãã¡ããã¡ãæéããããã¾ãã
綺éºãªãã§ãããã¡ããã¡ãéãã§ãã
key | value |
---|---|
Instruction Mix | 1021 |
GPU Duration | 4970 μs |
FPS | 133 |
PractRand Failed | > 235 |
ãã¾ãã«ãéã (64 GiB ã®ãã¹ãã«åæ¥ããã£ã) ã®ã§ãã¹ãã¯ããã¾ã§ã§è«¦ãã¾ããã
heptaplex-collapse noise
// @ENDESGA 2023 uint heptaplex_orig(uint x, uint y, uint z) { x = ~(~x - y - z) * ~(x - ~y - z) * ~(x - y - ~z); y = ~(~x - y - z) * ~(x - ~y - z) * ~(x - y - ~z); z = x ^ y ^ (~(~x - y - z) * ~(x - ~y - z) * ~(x - y - ~z)); return z ^ ~(~z >> 16); } float heptaplex(float4 v) { return (heptaplex_orig(v.x, v.y, v.z) + heptaplex_orig(v.w, 0, 0)) * 2.3283064365386962890625e-10; }
heptaplex-collapse noise ã¯ã 2023 å¹´ã« ENDESGA æ°ã Shadertoy ä¸ã§çºè¡¨ãããã¤ãºã§ãã *37
ã±ã£ã¨è¦ã¯ç¶ºéºã§ãã
key | value |
---|---|
Instruction Mix | 46 |
GPU Duration | 28.67 μs |
FPS | 2557 |
PractRand Failed | 219 |
ãã¹ãã¯å³æ»ã§ã¯ãªããã®ã®ããããªãã®æ©ãã§è½ã¡ã¦ãã¾ãã¾ããã
IbukiHash
// IbukiHash by Andante // This work is marked with CC0 1.0. To view a copy of this license, visit https://creativecommons.org/publicdomain/zero/1.0/ float ibuki(float4 v) { const uint4 mult = uint4(0xae3cc725, 0x9fe72885, 0xae36bfb5, 0x82c1fcad); uint4 u = uint4(v); u = u * mult; u ^= u.wxyz ^ u >> 13; uint r = dot(u, mult); r ^= r >> 11; r = (r * r) ^ r; return r * 2.3283064365386962890625e-10; }
è¦æ
£ããªãé¢æ°ãã¨æãã¾ãããããã¯ããã§ãã ç§ãä»ä½ãã¾ããã
å½ä»¤æ° (Instruction Mix) ããªãã¹ãå°ãªãããã¤ãã¹ãã«ã¯ 1 TiB ã¾ã§éãããã«è¨è¨ãã¾ããã
key | value |
---|---|
Instruction Mix | 26 |
GPU Duration | 27.65 μs |
FPS | 2681 |
PractRand Failed | 241 |
è¨è¨ææ³
IbukiHash
ã®å
¨ã¦ã®è¡ã«æå³ãããã¾ãã
èå³ããªãæ¹ã¯èªã¿é£ã°ãã¦ããã ãã¦å¤§ä¸å¤«ã§ãã
const uint4 mult = uint4(0xae3cc725, 0x9fe72885, 0xae36bfb5, 0x82c1fcad);
ä¹ç®ã®å®æ°ã¯ã詳細ã¯çãã¾ããããããåæ£ããããå¤ã«ããå¿
è¦ãããã¾ãã
ä»åã¯åæ£ã®è¯ãå¤ãç 究ãã¦ããè«æããå¼ç¨ãã¾ããã *38
絶対ã«ãã®å®æ°ã§ããå¿
è¦ã¯ãªãã®ã§å¤æ´ãããã¨ãã§ãã¾ãããã¨ãã° uint4
ãè¿ãå¤ã¨ãã¦ã»ãããªã£ãå ´åã«å¥ã®å®æ°ã§è¨ç®ãããªã©ã
ãã ãå°ãªãã¨ãæä¸ä½ãããã 1 ã§ãã¤æä¸ä½ã® 3 ãããã 0b101 ã§ããããªãã«ããããåæ£ãã¦ãã (popcnt(mult)
ã 16 ã«è¿ãå¥æ°ã§ãã㤠0x0000ffff
ã¿ããã«åºã¾ã£ã¦ããªã) å¿
è¦ãããã¾ãã
uint4 u = uint4(v);
asint()
ã§ã¯ãªãåç´ãªãã£ã¹ãã«ãã¦ããã®ã¯ãä¸ä½ãããã«æå³ã®ããå¤ãéä¸ãããããã§ãã
ä»åå¼æ°ã«åãã®ã¯åº§æ¨ãªã®ã§ãã©ãã ãããã®å°ããç¯å²ã«ãããªãã¾ããããããªãã¨ãã©ãã«æå³ã®ããæ
å ± (ããã) ãç½®ãããéè¦ã«ãªãã¾ãã
ããã¦ä»å¾ããããæªæããã«ããã£ã¦ãä¸ä½ãããã«æ
å ±ããã£ãã»ãã好é½åãªããã§ãã
asint()
ã使ãã¨ã float
åã® ããããã¿ã¼ã³ ã®é½åä¸ä¸ä½ãããã«æ
å ±ãéã¾ããã¡ãä¸ä½ãããã 0 ã«ãªããã¡ã§ãã¾ããããããªãã£ãã®ã§ãã
測å®çµæãè¦ãéãã§ã¯ asint()
ã®ã»ããå¤å°éãæã¯ããã¾ããããå質ãè½ã¡ãï¼æ©ããã¹ãã«è½ã¡ãï¼å¾åãããã¾ããããªã®ã§è´ãæ¹ããã¾ããã
u = u * mult;
u
ã«å®æ°ãæãã ã§å²ã£ãä½ããå¾ã¾ãã
æãç®ã¯ããã·ã¥é¢æ°ã®ãªãã§ãé常ã«éè¦ãªè¦ç´ ã§ãä¸ä½ãããã®æ
å ±ãä¸ä½ãããã«å¹
åºãä¼æããããã¨ãã§ãã¾ãã
ãã¡ããã¡ãç°¡åã«è¨ãã°ãä¸ä½ãããã®ããã·ã¥ã¨ãã¦ã®ãå質ãã大ããé«ãããã¨ãã§ããæ¼ç®ã§ãã
ãæ³ã¨ããã¨ããå¥æ°å®æ°ã¨ã®æãç® x *= (a | 1)
ã¯å
¨åå°ã®æä½ã§ãã
ã¤ã¾ããç¹å®ã®å¤ã«åããã¨ããªããã¾ãã¹ããªãããããæ··ãããã¨ãã§ãã¾ãã
ããã§ã u
ã®åè¦ç´ ã«ããããå¥ã®å®æ°ãæãã¦ããçç±ã¯ãåãå®æ°ãæãã㨠u.x
㨠u.y
ã®å¤ã交æãã¦ãåãçµæãå¾ãããããã«ãªã£ã¦ãã¾ãã ã軸ã«å¯¾ç§°ã¨ãªã£ã¦ãã¾ãããã§ãã
HLSL ã§ã¯ uint4
ã©ããã®æãç®ãªã©ãã¾ã¨ãã¦è¡ããã®ã§ã¢ã»ã³ããªããããã£ã¦æé©åãããã®ãã¨æããããå°ãªãã¨ãä¸éè¨èª (DXIL) ã¬ãã«ã§ã¯å¥ã
ã«è¨ç®ããã¨ã (u.x *= mult.x; u.y *= mult.y; ...
) ã¨åããããªå½ä»¤ãçºè¡ããã¦ããããã§ãã
u ^= u.wxyz ^ u >> 13;
u
ã« xorshift ã£ã½ããã¨ããã¾ãã
ã¾ã u ^ u >> 13
ã§ãããä¹ç®ã§å質ãä¸ãã£ãä¸ä½ããããä¸ä½ãããã«å³ã·ããã§ä¼æãããä¸ãä¸ãå質ãåä¸ããã¾ãã
å ã㦠x ^= x >> a
ã¯ä¹ç®ã¨åããå
¨åå°ã®æä½ã§ããåããç¹å®ã®å¤ã«åããã¾ãã¹ããªãããããæ··ãããã¾ãã
ã·ããå®æ° 13
ã¯ã 32 bit ã®åå (16) ããå°ããæ大ã®ç´ æ°ãªã®ã§ä½¿ã£ã¦ãã¾ããã·ããã大ããããã¨ä¸ä½ãããã«ä¼æãããããªãã®ã§ãããä¼æãããããæ
å ±éèªä½ã¯æ¸ã£ã¦ãã¾ãã®ã§ããã©ã³ã¹ããé¸ã³ã¾ããã
ã¾ãã u.wxyz
ã¨ã¹ã¦ã£ãºã«ããå¤ã xor ãããã¨ã«ãã£ã¦ãå¥ã®ãããã¨ã®ã絡ã¿ããçºçããã¾ããä»ã¾ã§ã¯ u.xyzw
ã®ããããã®è¦ç´ ã®ä¸ã§ã ããããã®æ
å ±ä¼æãè¡ããã¦ãã¾ããããããã§ä»ã®è¦ç´ ã¨æ··ãããã¨ã§ããããã·ã¥ããããã¾ãã
uint r = dot(u, mult);
次ã«ãå ç©ãã¨ãã¾ããè¨ãæããã°ã
uint r = u.x * mult.x + u.y * mult.y + u.z * mult.z + u.w * mult.w;
ã§ããä¹ç®ã«ãã£ã¦å度æªæããã®ã¡ãå
¨è¦ç´ ãå ç®ãã¦ã²ã¨ã¤ã«ã¾ã¨ãã¾ãã
ã²ã¨ã¤ã«ã¾ã¨ãããã¨ã§ä»å¾ã®å½ä»¤æ°ãæ¸ããã¾ãã
ãã®ã¾ã¨ãã®ã¿ã¤ãã³ã°ãéè¦ã§ãæ©ããã㨠xyzw
ã®å·®å¥åãè¡ããã«ãã¹ãã«è½ã¡ãé
ãããã¨å½ä»¤æ°ãå¢ãã¦å®è¡ãé
ããªãã¾ãã
ã¾ãããã㦠dot()
ã使ã£ãã®ã¯ãå½ä»¤ã®æé©åãè¡ããããã§ãã
ã·ã§ã¼ãã¼ã®ä¸éè¨èªã§ãã DXIL ã«ã¯ã 32 bit æ´æ°ã®ä¹ç®ã¨å ç®ãåæã«è¡ãã mad
å½ä»¤ãããã¾ãã fma
(fused multiply add) ã®æ´æ°çã®ãããªã¤ã¡ã¼ã¸ã§ãã
dot()
ã使ãã¨ããã® mad
å½ä»¤ãæ´»ç¨ãã¦ããããæãã«å±éãã¦ããã¾ãã
; dot(u, mult) mul %1, u.x, mult.x ; %1 = u.x * mult.x; mad %1, u.y, mult.y, %1 ; %1 = u.y * mult.y + %1; mad %1, u.z, mult.z, %1 ; %1 = u.z * mult.z + %1; mad %1, u.w, mult.w, %1 ; %1 = u.w * mult.w + %1;
ãµã¤ãã«ä¹ç®ã¨å ç®ã§è¨ç®ããã¨ãªãã mad
å½ä»¤ã«ãã¦ãããªãã®ã§ã dot()
ã使ã£ã¦å½ä»¤ã®ç縮ãå³ãã¾ãã
r ^= r >> 11;
ã¾ã xorshift ããã¦ã dot()
ã§å質ãåä¸ããä¸ä½ãããã®æ
å ±ãä¸ä½ãããã«ãä¼æããã¾ãã
ããã®ã·ããå®æ° 11
ã¯ãååã®ã·ããå®æ° 13
ã¨äºãã«ç´ ã§ãããã¨ããé¸ã³ã¾ããã
ãã®ã»ããå質ãè¯ããªãå¾åãããããã§ããä½æã§ããâ¦â¦
r = (r * r) ^ r;
ã¾ãã r = (r * r) ^ (r | 1)
ã¯å
¨åå°ã®æä½ã§ãã
詳ããåçã¯ç§ã¯åãã£ã¦ãã¾ãããå°ãªãã¨ã uint
( ãæ³ã¨ããæ¼ç®) ã®ç¯å²ã§ã¯ç·å½ããã§å
¨åå°ã«ãªã£ã¦ãããã¨ã確èªãã¦ãã¾ãã
ãããå¥æ°å®æ°ã®ä¹ç® r *= (a | 1);
ããããããã®æªææ§è½ãè¯ãã¨ããåããããå®éã«ãã¹ãçµæãåä¸ãããã¨ããæ¡ç¨ãã¾ããã
ããããªãã§å
¨é¨ããã«ããªãã£ãã®ãã¨ããã¨ã mul
ã ãã§æ¸ãå¥æ°å®æ°ä¹ç®ã«æ¯ã¹ã¦ mul, xor
㨠1 å½ä»¤å¢ãã¦ãã¾ãããã§ããæå¾ã®ä¸çªå¤§äºãªã¨ããã«ä½¿ãã¾ããã
ã¨ããã§ã r | 1
ãæãã¦ãããããªããã¨æã£ãæ¹ã¯æ£ããã§ãã
ã§ããããã§ã¯æãã¦ãã¦ãããã®ã§ãã or ããªããªããã¨ã§å
¨åå°æä½ã§ã¯ãªããªãã¾ã (æä¸ä½ããããå¿
ã 0 ã«ãªãã¾ã) ãã§ããã float
ã®ç²¾åº¦ã¯ 24 bit ã§ãã®ã§ã uint
ã§ã¤ãã£ã 32 ãããã®ãã¡ä¸ä½ 8 ãããã®æ
å ±ã¯åãæ¨ã¦ããã¾ãããããã£ã¦å¤§ããåé¡ã«ã¯ãªãã¾ããã
1 å½ä»¤ã¶ãæ©ãããããã«çè«ãç ç²ã«ããã¨ããææ³ (?) ã§ãã
return r * 2.3283064365386962890625e-10;
æå¾ã«ã ãæã㦠㮠float
ã«æ»ãã¾ãã
ããã§ã代ããã« asfloat(0x3f800000 | r >> 9) - 1;
ã¨ããææ³ãããã¾ãã
asfloat()
ã使ãã»ãã¯ãè¦ããã« ã«ããããã¿ã¼ã³å¤æã㦠1 ãå¼ããã¨ã§ ã«å¤æããææ³ã§ãã asfloat()
æ³ã®ã»ããéããªãå ´åããããããã®ã§ãããå¤æå¾ã®æä¸ä½ããããå¿
ã 0 ã«ãªããã 23 bit 精度ã«ãªã£ã¦ãã¾ãåé¡ãããã¾ãã
対ãã¦ãæãç®ã®ã»ãã§ã¯ 24 bit 精度ãç¶æã§ãã¾ãããã®ãããæãç®ãé¸æãã¾ããã
以ä¸ãè¨è¨ã®ã話ã§ãã
ãã¤ã㯠CPU ä¸ã§æ¬ä¼¼ä¹±æ°çæå¨ãè¨è¨ãã¦ã¿ãããã¦ããã®ã§ããã GPU (ã·ã§ã¼ãã¼) ä¸ã¨ãªãã¨éãã¦ä½¿ããé¢æ°ãå½ä»¤ãéãã®ã§ãåæãéã£ã¦æ¥½ããã£ãã§ãã
ã¾ã¨ã
ã¿ããªå¤§å¥½ãæ¯è¼ã°ã©ãã®ãæéã§ãã
FPS ãå¾®å¦ã«ãã¦ã«ãªããªãæããã£ãã®ã§ãå½ä»¤æ°ã§æ¯è¼ãããã¨ã«ãã¾ãã
縦軸ã Instruction Mix (å½ä»¤æ°; å°ãªãã»ããéãã¨æå¾
ããã) ã横軸ã PractRand Failed (40 以ä¸ã¯åæ ¼ã¨ã¿ãªãã¦ãã) ã§ãã
ã¤ã¾ããå³ä¸ã«è¡ãã°è¡ãã»ã©è»½ãã¦å質ãè¯ããã¨ã«ãªãã¾ãã
IbukiHash ã¯åæ ¼ããã·ã§ã¼ãã¼ä¹±æ°ã®ãªãã§ã¯å½ä»¤æ°ãä¸çªå°ãªãã軽ãã¦å¼·ããã¨ãåããã¾ãã
PCG4D ãããç·ã§ããã
ã¾ããå質ãæ°ã«ããéãã ããæ±ãããªã fihash ã§ããããã
ãã¹ãã«ã¯è½ã¡ããã®ã®è¦ãç®ä¸ã¯åé¡ãªãããã ã£ãã®ã§ãæ´»ç¨ã§ããããããã¾ããã
å
ãã¼ã¿ã®è¡¨ãè²¼ã£ã¦ããã¾ãã
PractRand Failed â Instruction Mix ã®é ã«ã½ã¼ããã¦ããã¾ãã
Algorithm | Instruction Mix | GPU Duration | FPS | PractRand Failed |
---|---|---|---|---|
PCG4D | 29 | 27.65 | 2652 | 42 |
PCG3D | 38 | 28.67 | 2700 | 42 |
lowbias32 | 41 | 28.67 | 2638 | 42 |
IQInt2 | 42 | 26.62 | 2622 | 42 |
Wyhash | 87 | 28.67 | 2636 | 42 |
Philox | 294 | 62.46 | 2729 | 42 |
ibuki | 26 | 27.65 | 2681 | 41 |
MurmurHash3 | 43 | 39.94 | 2683 | 41 |
CityHash | 49 | 27.65 | 2695 | 41 |
ESGTSA | 38 | 26.62 | 2721 | 40 |
triple32 | 53 | 27.65 | 2603 | 39 |
PCG | 38 | 29.7 | 2704 | 38 |
MD5 | 227 | 78.85 | 2748 | > 38 |
Wang | 41 | 27.65 | 2586 | 35 |
AESCTR | 1021 | 4970 | 133 | > 35 |
Ranlim32 | 79 | 27.65 | 2595 | 28 |
PCG2D | 37 | 27.65 | 2664 | 27 |
xxHash32 | 42 | 27.65 | 2676 | 27 |
PCG3D16 | 30 | 27.65 | 2706 | 25 |
TEA | 87 | 29.7 | 2626 | 21 |
JenkinsHash | 93 | 27.65 | 2721 | 21 |
Superfast | 43 | 26.62 | 2636 | 19 |
heptaplex-collapse | 46 | 28.67 | 2557 | 19 |
IQInt32 | 34 | 27.65 | 2728 | 18 |
IQInt1 | 30 | 28.67 | 2630 | 17 |
fihash | 9 | 28.67 | 2642 | 16 |
Interleaved Gradient Noise | 10 | 26.62 | 2632 | 16 |
Trig | 11 | 27.65 | 2639 | 16 |
LCG | 14 | 27.65 | 2695 | 16 |
Fast | 16 | 27.65 | 2664 | 16 |
fast32hash | 17 | 28.67 | 2653 | 16 |
Pseudo | 20 | 27.65 | 2605 | 16 |
PerlinPerm | 21 | 128 | 2501 | 16 |
IQInt3 | 24 | 27.65 | 2580 | 16 |
Hash without Sine | 31 | 28.67 | 2702 | 16 |
Xorshift32 | 33 | 30.72 | 2636 | 16 |
mod289 | 39 | 27.65 | 2656 | 16 |
BBS4093 | 49 | 27.65 | 2667 | 16 |
FNV1 | 50 | 30.72 | 2656 | 16 |
BBS65521 | 53 | 27.65 | 2735 | 16 |
Xorshift128 | 10 | 26.62 | 2601 | 0 |
JKISS32 | 15 | 26.62 | 2687 | 0 |
HybridTaus | 25 | 27.65 | 2649 | 0 |
ä½è«ï¼GPU ã«ãã£ã¦ sin()
ã®è¿ãå¤ãéãåé¡
ã·ã§ã¼ãã¼ã® sin()
ãªã©ã®æ°å¦é¢æ°ã¯ ç°å¢ä¾å ã§ããã GPU ã«ãã£ã¦çµæãç°ãªãå ´åãããâ¦â¦ã¨ hashwosine
ã®é
ã§æ¸ãã¾ããã
ããã¯æ¬å½ãªã®ã§ããããï¼
å®éã«è©¦ãã¦ã¿ã¾ãããã
ä¸çªãæ軽ãªã®ã PC (NVIDIA GeForce RTX 3060 Ti) 㨠Android (ASUS_I005DC; Adreno 660) éã§ã®æ¯è¼ã§ããã
Unity ã§ã³ã³ãã¥ã¼ãã·ã§ã¼ãã¼ãæ¸ãã¦ãã«ããã¦è©¦ãã¦ã¿ã¾ããã
ã¤ãã§ã«ãã°ã°ã£ã¦ããã NVIDIA GPU ã«ããã sin()
ã¯ããããã³ã¼ãã§å®è£
ããã¦ããå ´åããããã¨ããã¾ããã
// see: https://developer.download.nvidia.com/cg/sin.html static float pseudoSin(float a) { var c0 = new Vector4(0.0f, 0.5f, 1.0f, 0.0f); var c1 = new Vector4(0.25f, -9.0f, 0.75f, 0.159154943091f); var c2 = new Vector4(24.9808039603f, -24.9808039603f, -60.1458091736f, 60.1458091736f); var c3 = new Vector4(85.4537887573f, -85.4537887573f, -64.9393539429f, 64.9393539429f); var c4 = new Vector4(19.7392082214f, -19.7392082214f, -1.0f, 1.0f); Vector3 r0, r1, r2; r1.x = c1.w * a - c1.x; r1.y = frac(r1.x); r2.x = (r1.y < c1.x) ? 1 : 0; r2.y = (r1.y >= c1.y) ? 1 : 0; r2.z = (r1.y >= c1.z) ? 1 : 0; r2.y = Vector3.Dot(r2, new Vector3(c4.z, c4.w, c4.z)); r0 = new Vector3(c0.x - r1.y, c0.y - r1.y, c0.z - r1.y); r0 = new Vector3(r0.x * r0.x, r0.y * r0.y, r0.z * r0.z); r1 = new Vector3(c2.x * r0.x + c2.z, c2.y * r0.y + c2.w, c2.x * r0.z + c2.z); r1 = new Vector3(r1.x * r0.x + c3.x, r1.y * r0.y + c3.y, r1.z * r0.z + c3.x); r1 = new Vector3(r1.x * r0.x + c3.z, r1.y * r0.y + c3.w, r1.z * r0.z + c3.z); r1 = new Vector3(r1.x * r0.x + c4.x, r1.y * r0.y + c4.y, r1.z * r0.z + c4.x); r1 = new Vector3(r1.x * r0.x + c4.z, r1.y * r0.y + c4.w, r1.z * r0.z + c4.z); return Vector3.Dot(r1, -r2); }
ããã¨å¤ãä¸è´ããããæ¯ã¹ã¦ã¿ã¾ãããã
0
ï½ PI/2
(90°) ã¾ã§ã 256 çåããå¤ãããããã® sin
ã«ä¸ãã¦æ¯è¼ãã¾ããã
<GPU ãã¤ãã£ãã® sin()> = <NVIDIA ã® sin()> ; <CPU ã® Mathf.Sin()>
ã¨ãããã©ã¼ãããã§ãã
Android
0 = 0 ; 0
0.006135901 = 0.006135881 ; 0.006135885
0.01227157 = 0.01227158 ; 0.01227154
0.01840678 = 0.01840681 ; 0.01840673
0.0245413 = 0.02454126 ; 0.02454123
0.03067489 = 0.03067487 ; 0.0306748
0.03680732 = 0.03680724 ; 0.03680722
0.04293814 = 0.04293823 ; 0.04293826
0.04906758 = 0.04906774 ; 0.04906768
0.05519516 = 0.05519527 ; 0.05519525
0.06132067 = 0.06132072 ; 0.06132074
0.06744387 = 0.06744397 ; 0.06744392
0.07356453 = 0.07356453 ; 0.07356457
0.07968242 = 0.07968247 ; 0.07968244
0.08579731 = 0.08579737 ; 0.08579732
0.09190897 = 0.09190899 ; 0.09190895
0.09801717 = 0.0980171 ; 0.09801714
0.1041217 = 0.1041216 ; 0.1041216
0.1102223 = 0.1102223 ; 0.1102222
0.1163187 = 0.1163187 ; 0.1163186
0.1224108 = 0.1224107 ; 0.1224107
0.128498 = 0.1284981 ; 0.1284981
0.1345806 = 0.1345807 ; 0.1345807
0.1406582 = 0.1406583 ; 0.1406582
0.1467304 = 0.1467305 ; 0.1467305
0.1527971 = 0.1527972 ; 0.1527972
0.1588581 = 0.1588582 ; 0.1588582
0.1649131 = 0.1649132 ; 0.1649131
0.1709619 = 0.1709619 ; 0.1709619
0.1770042 = 0.1770043 ; 0.1770042
0.1830399 = 0.1830398 ; 0.1830399
0.1890687 = 0.1890687 ; 0.1890687
0.1950904 = 0.1950904 ; 0.1950903
0.2011047 = 0.2011046 ; 0.2011046
0.2071115 = 0.2071114 ; 0.2071114
0.2131102 = 0.2131104 ; 0.2131103
0.2191012 = 0.2191013 ; 0.2191012
0.2250838 = 0.2250839 ; 0.2250839
0.2310581 = 0.2310581 ; 0.2310581
0.2370236 = 0.2370237 ; 0.2370236
0.2429802 = 0.2429802 ; 0.2429802
0.2489276 = 0.2489277 ; 0.2489276
0.2548656 = 0.2548657 ; 0.2548657
0.2607941 = 0.2607941 ; 0.2607941
0.2667128 = 0.2667128 ; 0.2667128
0.2726214 = 0.2726214 ; 0.2726214
0.2785197 = 0.2785197 ; 0.2785197
0.2844076 = 0.2844076 ; 0.2844076
0.2902848 = 0.2902847 ; 0.2902847
0.2961508 = 0.2961509 ; 0.2961509
0.3020059 = 0.302006 ; 0.3020059
0.3078496 = 0.3078496 ; 0.3078497
0.3136817 = 0.3136817 ; 0.3136818
0.319502 = 0.3195021 ; 0.319502
0.3253103 = 0.3253103 ; 0.3253103
0.3311063 = 0.3311063 ; 0.3311063
0.3368898 = 0.3368899 ; 0.3368899
0.3426607 = 0.3426607 ; 0.3426607
0.3484187 = 0.3484187 ; 0.3484187
0.3541636 = 0.3541635 ; 0.3541635
0.3598951 = 0.3598951 ; 0.3598951
0.3656131 = 0.365613 ; 0.365613
0.3713173 = 0.3713173 ; 0.3713172
0.3770073 = 0.3770074 ; 0.3770074
0.3826834 = 0.3826834 ; 0.3826835
0.388345 = 0.3883451 ; 0.388345
0.393992 = 0.3939921 ; 0.3939921
0.3996242 = 0.3996242 ; 0.3996242
0.4052413 = 0.4052413 ; 0.4052413
0.4108432 = 0.4108432 ; 0.4108432
0.4164295 = 0.4164296 ; 0.4164296
0.4220003 = 0.4220003 ; 0.4220003
0.4275551 = 0.4275551 ; 0.4275551
0.4330939 = 0.4330938 ; 0.4330938
0.4386163 = 0.4386162 ; 0.4386162
0.4441222 = 0.4441222 ; 0.4441222
0.4496114 = 0.4496114 ; 0.4496113
0.4550835 = 0.4550836 ; 0.4550836
0.4605387 = 0.4605387 ; 0.4605387
0.4659764 = 0.4659765 ; 0.4659765
0.4713967 = 0.4713967 ; 0.4713967
0.4767992 = 0.4767992 ; 0.4767992
0.4821838 = 0.4821838 ; 0.4821838
0.4875502 = 0.4875501 ; 0.4875502
0.4928982 = 0.4928982 ; 0.4928982
0.4982277 = 0.4982277 ; 0.4982277
0.5035384 = 0.5035384 ; 0.5035384
0.5088302 = 0.5088301 ; 0.5088302
0.5141028 = 0.5141028 ; 0.5141028
0.5193561 = 0.519356 ; 0.519356
0.5245896 = 0.5245897 ; 0.5245897
0.5298036 = 0.5298036 ; 0.5298036
0.5349975 = 0.5349976 ; 0.5349976
0.5401714 = 0.5401715 ; 0.5401715
0.545325 = 0.545325 ; 0.545325
0.550458 = 0.550458 ; 0.550458
0.5555702 = 0.5555702 ; 0.5555702
0.5606616 = 0.5606616 ; 0.5606616
0.5657318 = 0.5657318 ; 0.5657318
0.5707808 = 0.5707808 ; 0.5707808
0.5758082 = 0.5758082 ; 0.5758082
0.580814 = 0.580814 ; 0.580814
0.5857979 = 0.5857979 ; 0.5857979
0.5907598 = 0.5907597 ; 0.5907597
0.5956992 = 0.5956993 ; 0.5956993
0.6006164 = 0.6006165 ; 0.6006165
0.605511 = 0.6055111 ; 0.605511
0.6103828 = 0.6103828 ; 0.6103828
0.6152316 = 0.6152316 ; 0.6152316
0.6200572 = 0.6200572 ; 0.6200572
0.6248595 = 0.6248595 ; 0.6248595
0.6296383 = 0.6296383 ; 0.6296383
0.6343933 = 0.6343933 ; 0.6343933
0.6391245 = 0.6391245 ; 0.6391245
0.6438316 = 0.6438316 ; 0.6438316
0.6485144 = 0.6485144 ; 0.6485144
0.6531729 = 0.6531729 ; 0.6531729
0.6578068 = 0.6578067 ; 0.6578067
0.6624157 = 0.6624157 ; 0.6624158
0.6669999 = 0.6669999 ; 0.6669999
0.6715589 = 0.671559 ; 0.671559
0.6760927 = 0.6760927 ; 0.6760927
0.680601 = 0.680601 ; 0.680601
0.6850836 = 0.6850836 ; 0.6850837
0.6895405 = 0.6895406 ; 0.6895406
0.6939715 = 0.6939715 ; 0.6939715
0.6983762 = 0.6983763 ; 0.6983763
0.7027548 = 0.7027547 ; 0.7027547
0.7071067 = 0.7071068 ; 0.7071068
0.7114323 = 0.7114322 ; 0.7114322
0.7157309 = 0.7157308 ; 0.7157308
0.7200025 = 0.7200025 ; 0.7200025
0.7242471 = 0.7242471 ; 0.7242471
0.7284644 = 0.7284644 ; 0.7284644
0.7326542 = 0.7326543 ; 0.7326543
0.7368165 = 0.7368165 ; 0.7368166
0.7409511 = 0.7409511 ; 0.7409512
0.7450578 = 0.7450578 ; 0.7450578
0.7491364 = 0.7491364 ; 0.7491364
0.7531868 = 0.7531868 ; 0.7531868
0.7572088 = 0.7572088 ; 0.7572089
0.7612023 = 0.7612024 ; 0.7612024
0.7651672 = 0.7651673 ; 0.7651673
0.7691032 = 0.7691033 ; 0.7691033
0.7730104 = 0.7730105 ; 0.7730104
0.7768884 = 0.7768885 ; 0.7768885
0.7807372 = 0.7807372 ; 0.7807373
0.7845565 = 0.7845566 ; 0.7845566
0.7883464 = 0.7883464 ; 0.7883464
0.7921066 = 0.7921066 ; 0.7921066
0.7958369 = 0.7958369 ; 0.7958369
0.7995372 = 0.7995373 ; 0.7995373
0.8032075 = 0.8032075 ; 0.8032075
0.8068476 = 0.8068476 ; 0.8068476
0.8104572 = 0.8104572 ; 0.8104572
0.8140363 = 0.8140364 ; 0.8140363
0.8175848 = 0.8175848 ; 0.8175848
0.8211026 = 0.8211025 ; 0.8211026
0.8245894 = 0.8245893 ; 0.8245893
0.8280451 = 0.8280451 ; 0.8280451
0.8314696 = 0.8314696 ; 0.8314697
0.8348629 = 0.8348629 ; 0.8348629
0.8382248 = 0.8382247 ; 0.8382247
0.8415551 = 0.841555 ; 0.8415549
0.8448536 = 0.8448536 ; 0.8448536
0.8481205 = 0.8481203 ; 0.8481203
0.8513553 = 0.8513552 ; 0.8513552
0.8545578 = 0.854558 ; 0.854558
0.8577285 = 0.8577286 ; 0.8577287
0.8608669 = 0.8608669 ; 0.860867
0.8639728 = 0.8639728 ; 0.8639728
0.8670461 = 0.8670462 ; 0.8670462
0.8700869 = 0.870087 ; 0.870087
0.873095 = 0.873095 ; 0.873095
0.8760701 = 0.8760701 ; 0.8760701
0.8790122 = 0.8790122 ; 0.8790123
0.8819213 = 0.8819213 ; 0.8819213
0.8847971 = 0.8847971 ; 0.8847971
0.8876396 = 0.8876396 ; 0.8876396
0.8904487 = 0.8904487 ; 0.8904487
0.8932242 = 0.8932243 ; 0.8932243
0.8959663 = 0.8959662 ; 0.8959663
0.8986745 = 0.8986745 ; 0.8986745
0.9013488 = 0.9013488 ; 0.9013489
0.9039893 = 0.9039893 ; 0.9039893
0.9065958 = 0.9065957 ; 0.9065957
0.909168 = 0.909168 ; 0.909168
0.911706 = 0.911706 ; 0.911706
0.9142098 = 0.9142097 ; 0.9142098
0.9166791 = 0.9166791 ; 0.9166791
0.9191139 = 0.9191139 ; 0.9191139
0.9215141 = 0.921514 ; 0.921514
0.9238796 = 0.9238795 ; 0.9238795
0.9262103 = 0.9262102 ; 0.9262102
0.928506 = 0.9285061 ; 0.9285061
0.9307669 = 0.9307669 ; 0.930767
0.9329928 = 0.9329928 ; 0.9329928
0.9351835 = 0.9351835 ; 0.9351835
0.9373389 = 0.937339 ; 0.937339
0.9394591 = 0.9394592 ; 0.9394592
0.9415441 = 0.9415441 ; 0.9415441
0.9435934 = 0.9435934 ; 0.9435934
0.9456073 = 0.9456073 ; 0.9456074
0.9475855 = 0.9475856 ; 0.9475856
0.9495282 = 0.9495282 ; 0.9495282
0.951435 = 0.951435 ; 0.951435
0.953306 = 0.953306 ; 0.953306
0.9551411 = 0.9551412 ; 0.9551412
0.9569403 = 0.9569404 ; 0.9569404
0.9587035 = 0.9587035 ; 0.9587035
0.9604305 = 0.9604305 ; 0.9604306
0.9621214 = 0.9621214 ; 0.9621214
0.9637761 = 0.9637761 ; 0.9637761
0.9653945 = 0.9653944 ; 0.9653944
0.9669765 = 0.9669765 ; 0.9669765
0.9685221 = 0.9685221 ; 0.9685221
0.9700313 = 0.9700313 ; 0.9700313
0.971504 = 0.9715039 ; 0.9715039
0.97294 = 0.97294 ; 0.97294
0.9743394 = 0.9743394 ; 0.9743394
0.9757022 = 0.9757021 ; 0.9757021
0.9770282 = 0.9770281 ; 0.9770281
0.9783173 = 0.9783174 ; 0.9783174
0.9795697 = 0.9795698 ; 0.9795698
0.9807853 = 0.9807853 ; 0.9807853
0.9819639 = 0.9819639 ; 0.9819639
0.9831055 = 0.9831055 ; 0.9831055
0.9842101 = 0.9842101 ; 0.9842101
0.9852777 = 0.9852777 ; 0.9852777
0.9863081 = 0.9863081 ; 0.9863081
0.9873014 = 0.9873014 ; 0.9873014
0.9882575 = 0.9882576 ; 0.9882576
0.9891765 = 0.9891765 ; 0.9891765
0.9900582 = 0.9900582 ; 0.9900582
0.9909027 = 0.9909027 ; 0.9909027
0.9917098 = 0.9917098 ; 0.9917098
0.9924795 = 0.9924796 ; 0.9924796
0.993212 = 0.9932119 ; 0.993212
0.993907 = 0.993907 ; 0.993907
0.9945646 = 0.9945646 ; 0.9945646
0.9951847 = 0.9951847 ; 0.9951847
0.9957674 = 0.9957674 ; 0.9957674
0.9963126 = 0.9963126 ; 0.9963126
0.9968203 = 0.9968203 ; 0.9968203
0.9972904 = 0.9972904 ; 0.9972904
0.9977231 = 0.997723 ; 0.9977231
0.9981181 = 0.9981181 ; 0.9981181
0.9984756 = 0.9984756 ; 0.9984756
0.9987954 = 0.9987954 ; 0.9987954
0.9990777 = 0.9990777 ; 0.9990777
0.9993224 = 0.9993224 ; 0.9993224
0.9995294 = 0.9995294 ; 0.9995294
0.9996988 = 0.9996988 ; 0.9996988
0.9998306 = 0.9998306 ; 0.9998306
0.9999247 = 0.9999247 ; 0.9999247
0.9999812 = 0.9999812 ; 0.9999812
PC
0 = 0 ; 0
0.006135784 = 0.006135883 ; 0.006135885
0.01227134 = 0.0122716 ; 0.01227154
0.01840647 = 0.01840678 ; 0.01840673
0.02454119 = 0.02454128 ; 0.02454123
0.0306749 = 0.03067486 ; 0.0306748
0.03680708 = 0.03680725 ; 0.03680722
0.0429382 = 0.04293833 ; 0.04293826
0.04906752 = 0.04906771 ; 0.04906768
0.05519509 = 0.05519526 ; 0.05519525
0.06132066 = 0.06132074 ; 0.06132074
0.06744379 = 0.06744399 ; 0.06744392
0.07356446 = 0.07356455 ; 0.07356457
0.07968237 = 0.07968249 ; 0.07968244
0.08579737 = 0.08579735 ; 0.08579732
0.09190872 = 0.09190897 ; 0.09190895
0.09801697 = 0.09801711 ; 0.09801714
0.1041216 = 0.1041216 ; 0.1041216
0.1102219 = 0.1102223 ; 0.1102222
0.1163183 = 0.1163187 ; 0.1163186
0.1224106 = 0.1224107 ; 0.1224107
0.1284982 = 0.1284981 ; 0.1284981
0.1345807 = 0.1345807 ; 0.1345807
0.140658 = 0.1406582 ; 0.1406582
0.1467303 = 0.1467305 ; 0.1467305
0.1527971 = 0.1527972 ; 0.1527972
0.158858 = 0.1588582 ; 0.1588582
0.1649131 = 0.1649132 ; 0.1649131
0.1709618 = 0.1709619 ; 0.1709619
0.177004 = 0.1770042 ; 0.1770042
0.1830396 = 0.1830399 ; 0.1830399
0.1890684 = 0.1890686 ; 0.1890687
0.1950903 = 0.1950904 ; 0.1950903
0.2011045 = 0.2011046 ; 0.2011046
0.2071114 = 0.2071114 ; 0.2071114
0.2131103 = 0.2131104 ; 0.2131103
0.2191012 = 0.2191012 ; 0.2191012
0.2250838 = 0.225084 ; 0.2250839
0.2310579 = 0.2310581 ; 0.2310581
0.2370234 = 0.2370237 ; 0.2370236
0.2429801 = 0.2429802 ; 0.2429802
0.2489275 = 0.2489276 ; 0.2489276
0.2548656 = 0.2548657 ; 0.2548657
0.2607938 = 0.2607942 ; 0.2607941
0.2667127 = 0.2667128 ; 0.2667128
0.2726213 = 0.2726214 ; 0.2726214
0.2785195 = 0.2785197 ; 0.2785197
0.2844074 = 0.2844076 ; 0.2844076
0.2902845 = 0.2902847 ; 0.2902847
0.2961509 = 0.2961509 ; 0.2961509
0.3020057 = 0.3020059 ; 0.3020059
0.3078495 = 0.3078496 ; 0.3078497
0.3136816 = 0.3136818 ; 0.3136818
0.3195019 = 0.3195021 ; 0.319502
0.3253103 = 0.3253103 ; 0.3253103
0.331106 = 0.3311063 ; 0.3311063
0.3368898 = 0.3368899 ; 0.3368899
0.3426606 = 0.3426608 ; 0.3426607
0.3484185 = 0.3484187 ; 0.3484187
0.3541633 = 0.3541635 ; 0.3541635
0.3598949 = 0.359895 ; 0.3598951
0.3656131 = 0.365613 ; 0.365613
0.3713171 = 0.3713172 ; 0.3713172
0.3770073 = 0.3770074 ; 0.3770074
0.3826833 = 0.3826834 ; 0.3826835
0.388345 = 0.3883451 ; 0.388345
0.3939919 = 0.393992 ; 0.3939921
0.399624 = 0.3996242 ; 0.3996242
0.4052413 = 0.4052413 ; 0.4052413
0.4108431 = 0.4108432 ; 0.4108432
0.4164295 = 0.4164296 ; 0.4164296
0.422 = 0.4220003 ; 0.4220003
0.427555 = 0.4275551 ; 0.4275551
0.4330938 = 0.4330938 ; 0.4330938
0.438616 = 0.4386162 ; 0.4386162
0.444122 = 0.4441222 ; 0.4441222
0.4496112 = 0.4496114 ; 0.4496113
0.4550835 = 0.4550836 ; 0.4550836
0.4605385 = 0.4605387 ; 0.4605387
0.4659763 = 0.4659765 ; 0.4659765
0.4713967 = 0.4713967 ; 0.4713967
0.4767992 = 0.4767992 ; 0.4767992
0.4821836 = 0.4821838 ; 0.4821838
0.4875499 = 0.4875502 ; 0.4875502
0.4928981 = 0.4928982 ; 0.4928982
0.4982276 = 0.4982277 ; 0.4982277
0.5035383 = 0.5035384 ; 0.5035384
0.5088301 = 0.5088301 ; 0.5088302
0.5141026 = 0.5141028 ; 0.5141028
0.5193559 = 0.519356 ; 0.519356
0.5245895 = 0.5245897 ; 0.5245897
0.5298036 = 0.5298036 ; 0.5298036
0.5349975 = 0.5349976 ; 0.5349976
0.5401714 = 0.5401714 ; 0.5401715
0.545325 = 0.545325 ; 0.545325
0.5504579 = 0.550458 ; 0.550458
0.5555702 = 0.5555702 ; 0.5555702
0.5606615 = 0.5606616 ; 0.5606616
0.5657318 = 0.5657318 ; 0.5657318
0.5707806 = 0.5707808 ; 0.5707808
0.5758082 = 0.5758082 ; 0.5758082
0.5808139 = 0.5808139 ; 0.580814
0.5857978 = 0.5857978 ; 0.5857979
0.5907595 = 0.5907597 ; 0.5907597
0.5956993 = 0.5956993 ; 0.5956993
0.6006165 = 0.6006165 ; 0.6006165
0.6055108 = 0.6055111 ; 0.605511
0.6103826 = 0.6103828 ; 0.6103828
0.6152316 = 0.6152316 ; 0.6152316
0.6200572 = 0.6200572 ; 0.6200572
0.6248594 = 0.6248595 ; 0.6248595
0.629638 = 0.6296383 ; 0.6296383
0.6343932 = 0.6343933 ; 0.6343933
0.6391243 = 0.6391245 ; 0.6391245
0.6438313 = 0.6438316 ; 0.6438316
0.6485143 = 0.6485144 ; 0.6485144
0.6531728 = 0.6531729 ; 0.6531729
0.6578067 = 0.6578067 ; 0.6578067
0.6624157 = 0.6624158 ; 0.6624158
0.6669998 = 0.6669999 ; 0.6669999
0.6715588 = 0.671559 ; 0.671559
0.6760926 = 0.6760927 ; 0.6760927
0.6806009 = 0.680601 ; 0.680601
0.6850834 = 0.6850837 ; 0.6850837
0.6895405 = 0.6895406 ; 0.6895406
0.6939713 = 0.6939715 ; 0.6939715
0.6983762 = 0.6983762 ; 0.6983763
0.7027546 = 0.7027547 ; 0.7027547
0.7071068 = 0.7071068 ; 0.7071068
0.7114322 = 0.7114322 ; 0.7114322
0.7157307 = 0.7157308 ; 0.7157308
0.7200024 = 0.7200025 ; 0.7200025
0.724247 = 0.7242471 ; 0.7242471
0.7284644 = 0.7284644 ; 0.7284644
0.7326542 = 0.7326543 ; 0.7326543
0.7368164 = 0.7368166 ; 0.7368166
0.7409511 = 0.7409511 ; 0.7409512
0.7450578 = 0.7450578 ; 0.7450578
0.7491363 = 0.7491364 ; 0.7491364
0.7531867 = 0.7531868 ; 0.7531868
0.7572088 = 0.7572088 ; 0.7572089
0.7612023 = 0.7612024 ; 0.7612024
0.7651672 = 0.7651673 ; 0.7651673
0.7691032 = 0.7691033 ; 0.7691033
0.7730104 = 0.7730105 ; 0.7730104
0.7768884 = 0.7768885 ; 0.7768885
0.7807373 = 0.7807372 ; 0.7807373
0.7845566 = 0.7845566 ; 0.7845566
0.7883464 = 0.7883464 ; 0.7883464
0.7921065 = 0.7921066 ; 0.7921066
0.7958369 = 0.7958369 ; 0.7958369
0.7995371 = 0.7995373 ; 0.7995373
0.8032075 = 0.8032075 ; 0.8032075
0.8068476 = 0.8068476 ; 0.8068476
0.8104572 = 0.8104572 ; 0.8104572
0.8140362 = 0.8140363 ; 0.8140363
0.8175848 = 0.8175848 ; 0.8175848
0.8211026 = 0.8211025 ; 0.8211026
0.8245893 = 0.8245893 ; 0.8245893
0.8280449 = 0.8280451 ; 0.8280451
0.8314695 = 0.8314696 ; 0.8314697
0.8348628 = 0.8348629 ; 0.8348629
0.8382246 = 0.8382247 ; 0.8382247
0.8415549 = 0.841555 ; 0.8415549
0.8448536 = 0.8448536 ; 0.8448536
0.8481203 = 0.8481203 ; 0.8481203
0.8513551 = 0.8513552 ; 0.8513552
0.8545579 = 0.854558 ; 0.854558
0.8577285 = 0.8577286 ; 0.8577287
0.860867 = 0.860867 ; 0.860867
0.8639728 = 0.8639728 ; 0.8639728
0.8670462 = 0.8670462 ; 0.8670462
0.8700869 = 0.870087 ; 0.870087
0.873095 = 0.873095 ; 0.873095
0.8760701 = 0.8760701 ; 0.8760701
0.8790122 = 0.8790122 ; 0.8790123
0.8819212 = 0.8819213 ; 0.8819213
0.8847971 = 0.8847971 ; 0.8847971
0.8876396 = 0.8876396 ; 0.8876396
0.8904487 = 0.8904487 ; 0.8904487
0.8932243 = 0.8932243 ; 0.8932243
0.8959663 = 0.8959662 ; 0.8959663
0.8986745 = 0.8986745 ; 0.8986745
0.9013488 = 0.9013488 ; 0.9013489
0.9039893 = 0.9039893 ; 0.9039893
0.9065956 = 0.9065957 ; 0.9065957
0.9091679 = 0.909168 ; 0.909168
0.9117059 = 0.911706 ; 0.911706
0.9142097 = 0.9142098 ; 0.9142098
0.9166791 = 0.9166791 ; 0.9166791
0.9191139 = 0.9191139 ; 0.9191139
0.921514 = 0.921514 ; 0.921514
0.9238795 = 0.9238795 ; 0.9238795
0.9262102 = 0.9262102 ; 0.9262102
0.928506 = 0.9285061 ; 0.9285061
0.9307669 = 0.9307669 ; 0.930767
0.9329928 = 0.9329928 ; 0.9329928
0.9351835 = 0.9351835 ; 0.9351835
0.9373391 = 0.937339 ; 0.937339
0.9394592 = 0.9394592 ; 0.9394592
0.9415441 = 0.9415441 ; 0.9415441
0.9435934 = 0.9435934 ; 0.9435934
0.9456074 = 0.9456073 ; 0.9456074
0.9475856 = 0.9475856 ; 0.9475856
0.9495282 = 0.9495282 ; 0.9495282
0.951435 = 0.951435 ; 0.951435
0.953306 = 0.953306 ; 0.953306
0.9551411 = 0.9551412 ; 0.9551412
0.9569404 = 0.9569404 ; 0.9569404
0.9587035 = 0.9587035 ; 0.9587035
0.9604305 = 0.9604305 ; 0.9604306
0.9621213 = 0.9621214 ; 0.9621214
0.9637761 = 0.9637761 ; 0.9637761
0.9653944 = 0.9653944 ; 0.9653944
0.9669764 = 0.9669765 ; 0.9669765
0.968522 = 0.9685221 ; 0.9685221
0.9700311 = 0.9700313 ; 0.9700313
0.9715039 = 0.9715039 ; 0.9715039
0.97294 = 0.97294 ; 0.97294
0.9743394 = 0.9743394 ; 0.9743394
0.9757022 = 0.9757021 ; 0.9757021
0.9770282 = 0.9770281 ; 0.9770281
0.9783174 = 0.9783174 ; 0.9783174
0.9795697 = 0.9795698 ; 0.9795698
0.9807853 = 0.9807853 ; 0.9807853
0.9819639 = 0.9819639 ; 0.9819639
0.9831055 = 0.9831055 ; 0.9831055
0.9842101 = 0.9842101 ; 0.9842101
0.9852776 = 0.9852777 ; 0.9852777
0.9863081 = 0.9863081 ; 0.9863081
0.9873014 = 0.9873014 ; 0.9873014
0.9882575 = 0.9882576 ; 0.9882576
0.9891765 = 0.9891765 ; 0.9891765
0.9900582 = 0.9900582 ; 0.9900582
0.9909026 = 0.9909027 ; 0.9909027
0.9917097 = 0.9917098 ; 0.9917098
0.9924796 = 0.9924796 ; 0.9924796
0.993212 = 0.9932119 ; 0.993212
0.993907 = 0.993907 ; 0.993907
0.9945646 = 0.9945646 ; 0.9945646
0.9951847 = 0.9951847 ; 0.9951847
0.9957675 = 0.9957674 ; 0.9957674
0.9963127 = 0.9963126 ; 0.9963126
0.9968203 = 0.9968203 ; 0.9968203
0.9972905 = 0.9972904 ; 0.9972904
0.997723 = 0.997723 ; 0.997723
0.9981181 = 0.9981181 ; 0.9981181
0.9984756 = 0.9984756 ; 0.9984756
0.9987954 = 0.9987954 ; 0.9987954
0.9990778 = 0.9990777 ; 0.9990777
0.9993225 = 0.9993224 ; 0.9993224
0.9995294 = 0.9995294 ; 0.9995294
0.9996988 = 0.9996988 ; 0.9996988
0.9998307 = 0.9998306 ; 0.9998306
0.9999248 = 0.9999247 ; 0.9999247
0.9999812 = 0.9999812 ; 0.9999812
ããããããããã¨ã¯ã
- CPU 㨠GPU ã§
sin()
ã®å¤ãéãã㨠- å®éã« GPU ã«ãã£ã¦
sin()
ã®å¤ãå¤ããã㨠- CPU ã®
Mathf.Sin()
ã¯ç°å¢ã«ãããåãå¤ãè¿ãã¦ããã㨠- NVIDIA ã®
sin()
å¼ã¯ã©ã¡ãã¨ãå¾®å¦ã«éããã¨
ã§ãã
ããããã GPU ã® sin()
ã«ç°å¢éã§ã®åç¾æ§ãæ±ãã¦ã¯ãããªããã¨ãããã¨ããããã¾ããã
ä¾ãã°ãã¤ãºãå°å½¢çæã¨ãã«ä½¿ãã¨åãã·ã¼ãã§ãå¾®å¦ã«åç¾ã§ããªããã¿ãããªå¯è½æ§ãããã¾ãã
ãããã«
æ¬ç¨¿ã§ã¯ãã·ã§ã¼ãã¼ä¹±æ°ã®æ¯è¼æ¤è¨ãè¡ãã¾ããã
ã¿ãªãã frac(sin(...))
ã®ãã¤ã¯ãåç¥ã ã£ãããããã¾ããããç¥ããªãé¢æ°ãå¤ãã£ãã®ã§ã¯ãªãã§ããããã
æ¬è¨äºãçºè¦ã®ãã£ããã«ãªã£ããªã幸ãã§ãã
ã¾ããé«éã§é å¥ãªã·ã§ã¼ãã¼ä¹±æ° IbukiHash ãææ¡ãã¾ããã
ãã²ä½¿ã£ã¦ããã¦ãã ãããã©ã¤ã»ã³ã¹ã¯ CC0 ã§ãã
ã©ããä¹±æ°ãªãã¦ã³ãããããã®ãªã®ã§ãããããããæ©ã« frac(sin(...))
ã®ãã¤ããåãæ¿ãã¦ã¿ãããã¦ããã ããã°ã¨æãã¾ãï¼
GLSL ã§ã®å®è£ ã欲ããæ¹ã¯ã以ä¸ã® Shadertoy ãåç §ãã¦ãã ããã
https://www.shadertoy.com/view/XX3yRn
*1:Jarzynski, Mark, and Marc Olano. "Hash functions for gpu rendering." UMBC Computer Science and Electrical Engineering Department (2020). https://www.jcgt.org/published/0009/03/02/
*2:https://mrl.cs.nyu.edu/~perlin/noise/
*3:Gustavson, Stefan, and Ian McEwan. "Tiling simplex noise and flow noise in two and three dimensions." J Comput Graph Tech 11.1 (2022). https://jcgt.org/published/0011/01/02/paper.pdf
*4:Valdenegro-Toro, Matias, and Hector Pincheira. "Implementing Noise with Hash functions for Graphics Processing Units." arXiv preprint arXiv:1903.12270 (2019). https://arxiv.org/pdf/1903.12270
*5:A Hash Function for Hash Table Lookup, http://www.burtleburtle.net/bob/hash/doobs.html
*6:Blum, Lenore, Manuel Blum, and Mike Shub. "A simple unpredictable pseudo-random number generator." SIAM Journal on computing 15.2 (1986): 364-383.
*7:"google/cityhash: Automatically exported from code.google.com/p/cityhash", https://github.com/google/cityhash
*8:Schechter, Hagit, and Robert Bridson. "Evolving sub-grid turbulence for smoke animation." Proceedings of the 2008 ACM SIGGRAPH/Eurographics symposium on Computer animation. 2008. https://www.cs.ubc.ca/~rbridson/docs/schechter-sca08-turbulence.pdf
*9:Hash without Sine, https://www.shadertoy.com/view/4djSRW
*10:Howes, Lee, and David Thomas. "Efficient random number generation and application using CUDA." GPU gems 3 (2007): 805-830.
*11:Jorge Jimenez â Next Generation Post Processing in Call of Duty: Advanced Warfare, https://www.iryoku.com/next-generation-post-processing-in-call-of-duty-advanced-warfare/
*12:Integer Hash11, https://www.shadertoy.com/view/llGSzw
*13:Integer Hash33, https://www.shadertoy.com/view/XlXcW4
*14:Integer Hash21, https://www.shadertoy.com/view/4tXyWN
*15:Jones, David. "Good practice in (pseudo) random number generation for bioinformatics applications." URL http://www.cs.ucl.ac.uk/staff/d.jones/GoodPracticeRNG.pdf (2010).
*16:https://en.wikipedia.org/wiki/KISS_(algorithm)
*17:Press, William H., et al. Numerical recipes. Cambridge University Press, London, England, 1988.
*18:Rivest, Ronald. "RFC1321: The MD5 message-digest algorithm." (1992).
*19:Tzeng, Stanley, and Li-Yi Wei. "Parallel white noise generation on a GPU via cryptographic hash." Proceedings of the 2008 symposium on Interactive 3D graphics and games. 2008. ã½ã¼ã¹ã³ã¼ã㯠https://github.com/1iyiwei/parallel-white-noise/blob/master/src/code/OpenGL/md5.frag
*20:Oâneill, Melissa E. "PCG: A family of simple fast space-efficient statistically good algorithms for random number generation." ACM Transactions on Mathematical Software (2014).
*21:Jarzynski, Mark, and Marc Olano. "Hash functions for gpu rendering." UMBC Computer Science and Electrical Engineering Department (2020).
*22:Jarzynski, Mark, and Marc Olano. "Hash functions for gpu rendering." UMBC Computer Science and Electrical Engineering Department (2020).
*23:Press, William H. Numerical recipes 3rd edition: The art of scientific computing. Cambridge university press, 2007.
*24:Hash functions., http://www.azillionmonkeys.com/qed/hash.html
*25:Wheeler, David J., and Roger M. Needham. "TEA, a tiny encryption algorithm." Fast Software Encryption: Second International Workshop Leuven, Belgium, December 14â16, 1994 Proceedings 2. Springer Berlin Heidelberg, 1995.
*26:Integer Hash Function, http://web.archive.org/web/20071223173210/http://www.concentric.net/~Ttwang/tech/inthash.htm
*27:Marsaglia, George. "Xorshift rngs." Journal of Statistical software 8 (2003): 1-6.
*28:Marsaglia, George. "Xorshift rngs." Journal of Statistical software 8 (2003): 1-6.
*29:Cyan4973/xxHash: Extremely fast non-cryptographic hash algorithm, https://github.com/Cyan4973/xxHash
*30:wangyi-fudan/wyhash: The FASTEST QUALITY hash function, random number generators (PRNG) and hash map., https://github.com/wangyi-fudan/wyhash
*31:Prospecting for Hash Functions, https://nullprogram.com/blog/2018/07/31/
*32:Prospecting for Hash Functions, https://nullprogram.com/blog/2018/07/31/
*33:Creating reliable and efficient random hash for use in GPU shaders | by Lumi | Oct, 2024 | Medium, https://medium.com/@lumi_/creating-reliable-and-efficient-random-hash-for-use-in-gpu-shaders-fe5b5c9b6b72
*34:A fast and simple 32bit floating point hash function | briansharpe, https://briansharpe.wordpress.com/2011/11/15/a-fast-and-simple-32bit-floating-point-hash-function/
*35:Salmon, John K., et al. "Parallel random numbers: as easy as 1, 2, 3." Proceedings of 2011 international conference for high performance computing, networking, storage and analysis. 2011.
*36:Rijmen, Vincent, and Joan Daemen. "Advanced encryption standard." Proceedings of federal information processing standards publications, national institute of standards and technology 19 (2001): 22.
*37:heptaplex-collapse noise, https://www.shadertoy.com/view/ms3czf
*38:Steele Jr, Guy L., and Sebastiano Vigna. "Computationally easy, spectrally good multipliers for congruential pseudorandom number generators." Software: Practice and Experience 52.2 (2022): 443-458.