This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from PIL import Image | |
| def overlay_images(background_path, overlay_path, output_path, padding=40, transparency=0, top_margin=30): | |
| # Open background image | |
| background = Image.open(background_path) | |
| # Open overlay image | |
| overlay = Image.open(overlay_path) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val rng1 = Random(123) | |
| val rng2 = Random(123) | |
| val accumulatedResults = (1..simulations).map { | |
| val accumulatedReturnsA = simulatePortfolioAccumulatedReturns(portfolioA, rng1) | |
| val accumulatedReturnsB = simulatePortfolioAccumulatedReturns(portfolioB, rng2) | |
| SimulationResult(it, accumulatedReturnsA, accumulatedReturnsB) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val rng = Random(System.currentTimeMillis()) | |
| val accumulatedResults = (1..simulations).map { | |
| val accumulatedReturnsA = simulatePortfolioAccumulatedReturns(portfolioA, rng) | |
| val accumulatedReturnsB = simulatePortfolioAccumulatedReturns(portfolioB, rng) | |
| SimulationResult(it, accumulatedReturnsA, accumulatedReturnsB) | |
| } |
OlderNewer