diff options
author | Braxton Hall | 2022-10-30 18:32:43 +0000 |
---|---|---|
committer | GitHub | 2022-10-30 18:32:43 +0000 |
commit | a556712eaa077aed8a6798f24fc42c043b904d0a (patch) | |
tree | bbe2fecfd8328961cc245ee9de0413cdf43a1c88 | |
parent | 524d8c5e46ba22b068763e885850601464c25a56 (diff) | |
parent | b3e6a0cc52a7b42adc239ed1cad1622842f2cc9a (diff) |
Merge pull request #71 from cc-21/main
Add a buggy implementation
-rw-r--r-- | entries/cc-21/lazy_fib.java | 25 | ||||
-rw-r--r-- | people.json | 11 |
2 files changed, 36 insertions, 0 deletions
diff --git a/entries/cc-21/lazy_fib.java b/entries/cc-21/lazy_fib.java new file mode 100644 index 0000000..3d06152 --- /dev/null +++ b/entries/cc-21/lazy_fib.java @@ -0,0 +1,25 @@ +import java.util.Random; + +public class fib { + public static int lazy_fib_generator(int num) { + if (num == 0 || num == 1) return 1; + return lazy_fib_generator(num - 1) + lazy_fib_generator(num - 2); + } + + public static void lazy_fib_fuzzer(int num_of_trials) { + Random ran = new Random(); + for (int i = 0; i < num_of_trials; i++) { + try { + int val = ran.nextInt(); + System.out.format("Input value: %d \n", val); + lazy_fib_generator(val); + } catch (Throwable t) { + System.out.format("%s This is the price of being lazy!!\n", t); + } + } + } + + public static void main(String[] args) { + lazy_fib_fuzzer(10); + } +} diff --git a/people.json b/people.json index 297778c..9d3d340 100644 --- a/people.json +++ b/people.json @@ -555,6 +555,17 @@ ] }, { + "github": "cc-21", + "name": "Madonna H", + "title": "lazy", + "entries": [ + { + "name": "a buggy fib", + "link": "./entries/cc-21/lazy_fib.java" + } + ] + }, + { "github": "j-james", "name": "JJ", "title": "BSc, UBC", |