File indexing completed on 2026-04-09 07:49:12
0001 #include <curand_kernel.h>
0002
0003 #include "torch.h"
0004
0005 using namespace std;
0006
0007
0008 vector<sphoton> generate_photons(const storch& torch, unsigned int num_photons, unsigned int seed)
0009 {
0010 curandStatePhilox4_32_10 rng;
0011 curand_init(seed, 0, 0, &rng);
0012
0013 if (num_photons == 0)
0014 {
0015 num_photons = torch.numphoton;
0016 }
0017
0018 vector<sphoton> photons;
0019 int unused = -1;
0020 qtorch qt{.t = torch};
0021
0022 for (int i = 0; i < num_photons; i++)
0023 {
0024 sphoton photon;
0025 storch::generate(photon, rng, qt.q, unused, unused);
0026 photons.push_back(photon);
0027 }
0028
0029 return photons;
0030 }