${__P(threads, 10)} 1 true continue ${__P(loops, 50)} false ${__P(url, stitchaton.local)} 5000 http /api/image/generate true POST true true false { "canvas_rect": "${canvasRect}", "crop_offset": [0.25, 0.25], "crop_size": [0.5, 0.5], "output_scale": 0.5 } = true // Function to convert a numeric index (1-31) to the SBS Plate Row format (A-AE) String indexToRow(int num) { if (num <= 0) return ""; if (num <= 26) { // A-Z is ASCII 65-90. 'A' is char 65. So (num - 1) + 65. return (char)(num + 64) as String; } else { // For AA-AE, the first char is 'A'. // 27 -> AA, 28 -> AB, etc. // The second char is (num - 27) + 65 -> 'A', 'B', etc. return "A" + (char)(num - 26 + 64) as String; } } // Define the maximum starting indices for a 2x2 grid // Max row is AE (31), so max starting row is AD (30) // Max col is 55, so max starting col is 54 int maxStartRowIndex = 30; int maxStartCol = 54; // Generate random starting coordinates // nextInt(bound) generates 0 to bound-1, so add 1 int randomRowStartIndex = new Random().nextInt(maxStartRowIndex) + 1; int randomColStart = new Random().nextInt(maxStartCol) + 1; // Calculate the end coordinates for the 2x2 grid String rowStart = indexToRow(randomRowStartIndex); String rowEnd = indexToRow(randomRowStartIndex + 1); int colEnd = randomColStart + 1; // Construct the final canvas_rect string String canvasRectValue = "${rowStart}${randomColStart}:${rowEnd}${colEnd}"; // Store the generated string in a JMeter variable named "canvasRect" // This makes it available to the HTTP Request sampler vars.put("canvasRect", canvasRectValue); // Optional: Log the generated value to see it in the JMeter log (for debugging) log.info("Generated canvas_rect: " + canvasRectValue); groovy Content-Type application/json false saveConfig true true true true true true true false true true false false false true false false false true 0 true true true true true true /home/ibnufadhil/Documents/projects/benchmark/result.csv false saveConfig true true true true true true true false true true false false false true false false false true 0 true true true true true true