This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Borrowed from: github.com/TanStack/form/issues/1583#issuecomment-3127845132 | |
| /** | |
| * Modifies the provided schema to be nullable on input, but non-nullable on output. | |
| */ | |
| function nullableInput<TSchema extends ZodType>(schema: TSchema) { | |
| return schema.nullable().transform((value, ctx) => { | |
| if (value === null) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void generateRandomVector(std::vector<int>& inputVector, const std::pair<int,int> RAND_BOUNDS, const int VEC_SIZE) { | |
| std::random_device rnd_device; | |
| std::mt19937 mersenne_engine{rnd_device()}; | |
| std::uniform_int_distribution<int> distribution {RAND_BOUNDS.first, RAND_BOUNDS.second}; | |
| auto generator = [&distribution, &mersenne_engine]() { | |
| return distribution(mersenne_engine); | |
| }; |