Skip to content

Commit

Permalink
chore: minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Jan 9, 2025
1 parent 8918b2f commit 2459e16
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 32 deletions.
38 changes: 19 additions & 19 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions resources/sourcecode/montecarlo-pi.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
#include <time.h>

int main(int argc, char* argv[]) {
double x,y,z,count;

int n = atoi(argv[1]); // Number of iterations
double x,y,z;
int count = 1;

srand(time(NULL));

int n = atoi(argv[1]); // User input: number of iterations to perform

for (int i = 0; i < n; i++) {
x = (double) rand() / RAND_MAX;
y = (double) rand() / RAND_MAX;
z = x * x + y * y;
if (z <= 1) count++;
if ((x * x + y * y) <= 1) count++;
}

printf("π approx.: %g", (count / n) * 4);
printf("π approx.: %g\n", ((double)count / n) * 4);

return(0);
}
8 changes: 4 additions & 4 deletions src/thesis/imports/preamble.typ
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#import "@preview/diagraph:0.3.0": *
#import "@preview/codly:1.1.1": *
#import "@preview/codly-languages:0.1.1": *
#import "@preview/glossarium:0.5.0": make-glossary, register-glossary, print-glossary, gls, glspl
#import "@preview/codly:1.2.0": *
#import "@preview/codly-languages:0.1.4": *
#import "@preview/glossarium:0.5.1": make-glossary, register-glossary, print-glossary, gls, glspl
#show: make-glossary
#import "@preview/xarrow:0.3.1": xarrow, xarrowSquiggly, xarrowTwoHead
#import "@preview/hydra:0.4.0": *
#import "@preview/hydra:0.5.2": *
#import "@preview/cetz:0.3.1"
#import "colors.typ": *
#import "workarounds.typ": *
5 changes: 2 additions & 3 deletions src/thesis/imports/workarounds.typ
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#import "@preview/codelst:2.0.2": sourcecode, sourcefile
#import "@preview/codly:1.1.1": *
#import "@preview/codly-languages:0.1.1": *
#import "@preview/codly:1.2.0": *
#import "@preview/codly-languages:0.1.4": *
#import "../theme/common/metadata.typ": *

#let sourcefile(file: none, lang: none) = {
Expand Down

0 comments on commit 2459e16

Please sign in to comment.