Skip to content

Commit

Permalink
Merge pull request #2 from kaazing/zero-denominator-fix
Browse files Browse the repository at this point in the history
fix divide by zero
  • Loading branch information
sidda-at-kaazing authored Mar 7, 2018
2 parents ed031fb + 77c1443 commit 5071a5a
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
*.iml
logs
/target/
2 changes: 1 addition & 1 deletion src/main/java/com/lc/df/kafka/client/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static String getNewPayload(String payload,String eventid,String marketid
if (selectionid != null)
{
int num = getRandomIntInRange(PRICE_NUM_LIMIT);
int den = getRandomIntInRange(PRICE_DEN_LIMIT);
int den = getRandomIntInRange(PRICE_DEN_LIMIT) + 1; //prevent divide by zero
double decimal = 1 + ((double)num/(double)den);
DecimalFormat f = new DecimalFormat("##.00");
pl = payload.replaceAll("\\$\\{selection\\}", selectionid)
Expand Down
Binary file modified target/classes/com/lc/df/kafka/client/Utils.class
Binary file not shown.
Binary file not shown.
Binary file modified target/kafka-load-generator-0.0.1-SNAPSHOT.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion target/maven-archiver/pom.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Generated by Maven
#Tue Feb 27 16:31:21 PST 2018
#Tue Mar 06 16:07:23 PST 2018
version=0.0.1-SNAPSHOT
groupId=com.lc.df.kafka
artifactId=kafka-load-generator

0 comments on commit 5071a5a

Please sign in to comment.