From 5600e28c47e4e6672c8e93a35aec0957236e1356 Mon Sep 17 00:00:00 2001 From: cc-21 Date: Sat, 29 Oct 2022 21:51:57 -0700 Subject: Add a buggy implementation --- entries/cc-21/lazy_fib.java | 25 +++++++++++++++++++++++++ people.json | 13 ++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 entries/cc-21/lazy_fib.java 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 dd1b05c..de7ea5b 100644 --- a/people.json +++ b/people.json @@ -553,5 +553,16 @@ "link": "./entries/kekerr/fib.ts" } ] - } + }, + { + "github": "cc-21", + "name": "Madonna H", + "title": "lazy", + "entries": [ + { + "name": "a buggy fib", + "link": "./entries/cc-21/fib.java" + } + ] + } ] -- cgit v1.2.3-70-g09d2 From b3e6a0cc52a7b42adc239ed1cad1622842f2cc9a Mon Sep 17 00:00:00 2001 From: Braxton Hall Date: Sun, 30 Oct 2022 11:32:22 -0700 Subject: Update people.json --- people.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/people.json b/people.json index 0d42b90..9d3d340 100644 --- a/people.json +++ b/people.json @@ -561,7 +561,7 @@ "entries": [ { "name": "a buggy fib", - "link": "./entries/cc-21/fib.java" + "link": "./entries/cc-21/lazy_fib.java" } ] }, -- cgit v1.2.3-70-g09d2