MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / rand_normal

Function rand_normal

yolo_detector/darknet_opt/src/utils.c:642–661  ·  view source on GitHub ↗

From http://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform

Source from the content-addressed store, hash-verified

640
641// From http://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform
642float rand_normal()
643{
644 static int haveSpare = 0;
645 static double rand1, rand2;
646
647 if(haveSpare)
648 {
649 haveSpare = 0;
650 return sqrt(rand1) * sin(rand2);
651 }
652
653 haveSpare = 1;
654
655 rand1 = rand() / ((double) RAND_MAX);
656 if(rand1 < 1e-100) rand1 = 1e-100;
657 rand1 = -2 * log(rand1);
658 rand2 = (rand() / ((double) RAND_MAX)) * TWO_PI;
659
660 return sqrt(rand1) * cos(rand2);
661}
662
663/*
664 float rand_normal()

Callers 5

make_random_imageFunction · 0.85
make_convolutional_layerFunction · 0.85
test_dcganFunction · 0.85
train_dcganFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_dcganFunction · 0.68