Random Grocery Unit Price Comparison Quiz Generator
Draw distinct offer pairs and compare exact rational minor-unit prices by BigIntcross-products, retaining ties. All quantities in one caller common integer unit, prices in one currency; display divisions only, no tax/promotion, nutrition or current grocery-price inference.
Description
Unit-price comparison requires offers to share a currency and a common quantity unit.
Unit-price comparison requires offers to share a currency and a common quantity unit.1
This quiz draws two distinct offers per question and compares their ratios exactly, retaining ties even when display divisions are rounded.
When to use Random Grocery Unit Price Comparison Quiz Generator
Use this tool when you need to produce the reproducible draw or model experiment described below. Prepare a reproducible seed and the inventory, corpus, or experiment parameters stated below.
How to use Random Grocery Unit Price Comparison Quiz Generator and understand its results
- Prepare a reproducible seed and the inventory, corpus, or experiment parameters stated below.
- Enter seed, count, offerPricesMinor, offerQuantityInCommonIntegerUnits, offerIds, following the field table and calculation rules below, then run the tool.
- Read result. For result objects, inspect the nested output fields below, including any missing evidence or selected indices.
- Correct any input issues and run again. Before using a successful result, review its units, signs, evidence coverage, and stated model or reference assumptions.
| Input field | Meaning | Value type | Requirement |
|---|---|---|---|
| seed | Required nonblank deterministic seed; the SDK can replace the source with context.random. | string | Required |
| count | Number of draws, cards, trials, or output entries under the tool-specific rule; safe integer 1–64 with any narrower inventory bound. | number | Required |
| offerPricesMinor | Offer prices minor; integer minor units in the explicit currency basis. | list of number | Required |
| offerQuantityInCommonIntegerUnits | Offer quantity in common integer units | list of number | Required |
| offerIds | Offer ids | list of string | Required |
Require at least two unique offer IDs, aligned nonnegative safe-integer minor-unit prices, and positive safe-integer quantities in one common unit. Draw each pair without replacement using one advancing source; pairs across questions can repeat. Compare BigInt priceA×quantityB with priceB×quantityA, returning both cheaper IDs for an exact tie. Unit-price divisions are display values only. Count is one through sixty-four quizzes.2, 3
Use a nonblank seed of at most 256 UTF-16 units and a safe-integer count from 1 to 64, subject to the tool’s narrower inventory bound. By default the seed is hashed into a deterministic pseudorandom state; each run restarts that state, so identical full inputs and implementation reproduce the result. The SDK may provide context.random, which replaces the seeded source and advances across the request; the seed remains required. Every source value must be finite in [0,1), with a request limit of 100000 source calls. Draw an index as floor(U×remainingSize). For indexed inventory draws, with replacement draw from the full inventory each time; without replacement remove each chosen position from an ordered pool and reject counts exceeding the inventory size. Uniform-source draws are over positions, not necessarily distinct values. This is not secure randomness.
compare(priceA/quantityA,priceB/quantityB) via priceA×quantityB−priceB×quantityA Read these symbols with the field meanings and branch or reference rules above.
| Output field | Meaning | Value type |
|---|---|---|
| result | Composite output; read its nested fields and the worked example. | object |
| result.quizzes | quizzes | list |
Where monetary amounts are used, keep one explicit currency and minor-unit basis; one basis point is 0.01 percent. Monetary integers and exact products must remain in JavaScript’s safe-integer range. Rational rounding uses nearest minor unit with half ties away from zero, rather than binary floating-point rounding. An input called a reference amount does not fetch or establish an actual price.
{
"input": {
"seed": "tool.io/batch42",
"count": 1,
"offerPricesMinor": [
100,
120,
250
],
"offerQuantityInCommonIntegerUnits": [
2,
3,
5
],
"offerIds": [
"a",
"b",
"c"
]
},
"output": {
"result": {
"quizzes": [
{
"offerIds": [
"c",
"b"
],
"unitPricesMinor": [
50,
40
],
"cheaperOfferIds": [
"b"
],
"exactUnitPriceTie": false
}
]
}
}
} Limitations and assumptions
The comparison excludes taxes, promotions, quality, and differing quantity-unit conversions. The tool does not fetch actual offers or recommend a purchase.
Missing required fields, unknown fields, wrong types, and violated calculation rules return input issues. Numeric values must be finite; nonfinite numeric outputs are rejected. Arrays must be dense, with no missing cells. Numeric lists allow at most 10000 entries, subject to smaller tool-specific bounds above. Ordinary string lists allow at most 128 strings of at most 128 UTF-16 units each. Extremely large composite outputs are rejected.
Alternative or Complementary methods
For a related task, use Random Currency Code Generator: Currency codes identify a currency independently of the symbol used to display it. This generator samples eight stored code tokens for educational or formatting fixtures and does not fetch a current currency registry or exchange rate. For a complementary step, use Auction Seller Commission Net Proceeds Calculator: A seller’s net proceeds depend on hammer price, commission, and fixed charges. This calculator uses explicit minor-unit amounts and a supplied commission rate, allowing charges to exceed the price.
References
Similar or alternative tools
- Random Currency Code Generator
Currency codes identify a currency independently of the symbol used to display it. This generator samples eight stored code tokens for educational or formatting fixtures and does not fetch a current currency registry or exchange rate.
- Auction Seller Commission Net Proceeds Calculator
A seller’s net proceeds depend on hammer price, commission, and fixed charges. This calculator uses explicit minor-unit amounts and a supplied commission rate, allowing charges to exceed the price.