# Accelerate random number generation with OpenRNG and Performix

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/servers-and-cloud-computing/openrng-with-performix/)
- [Set up your environment](https://learn.arm.com/learning-paths/servers-and-cloud-computing/openrng-with-performix/how-to-1/)
- [Run the baseline data-processing example](https://learn.arm.com/learning-paths/servers-and-cloud-computing/openrng-with-performix/how-to-2/)
- [Identify code hotspots with Arm Performix](https://learn.arm.com/learning-paths/servers-and-cloud-computing/openrng-with-performix/how-to-3/)
- [Accelerate distribution generation with OpenRNG](https://learn.arm.com/learning-paths/servers-and-cloud-computing/openrng-with-performix/how-to-4/)
- [Measure performance improvements with a microbenchmark](https://learn.arm.com/learning-paths/servers-and-cloud-computing/openrng-with-performix/how-to-5/)
- [Next Steps](https://learn.arm.com/learning-paths/servers-and-cloud-computing/openrng-with-performix/_next-steps/)

## About this Learning Path

|  |  |
| --- | --- |
| Skill level: | Introductory |
| Reading time: | 45 min |
| Last updated: | 02 Oct 2026 |

|  |  |
| --- | --- |
| Author: | Kieran Hejmadi , Arm<br>[GitHub](https://github.com/kieranhejmadi01)<br>[LinkedIn](https://linkedin.com/in/kieran-hejmadi-88920815b) |
| Arm IP: | [Neoverse](https://support.arm.com/?tab=compute-ip&Product%20Type=Infrastructure%20Processors) |
| Tags: | [Performance and Architecture](https://learn.arm.com/tag/performance-and-architecture) [Linux](https://learn.arm.com/tag/linux) [CMake](https://learn.arm.com/tag/cmake) [Arm Performix](https://learn.arm.com/tag/arm-performix) [OpenRNG](https://learn.arm.com/tag/openrng) [Arm Performance Libraries](https://learn.arm.com/tag/arm-performance-libraries) |

### Who is this for?

This is an introductory topic for C++ developers who want to profile a data-processing workload on Arm Linux, identify performance bottlenecks with Arm Performix, and accelerate random number generation using OpenRNG and Arm Performance Libraries.

### What will you learn?

After completing this Learning Path, you'll be able to perform the following tasks:

- Build and run a baseline C++ data-processing workload on Arm Linux.
- Use Arm Performix Code Hotspots to identify the highest-impact optimization target.
- Accelerate random number generation by integrating OpenRNG and Arm Performance Libraries.
- Measure performance improvements using a microbenchmark across multiple data sizes.

### Prerequisites

Before starting, you'll need the following prerequisites:

- An Arm Linux (aarch64) server, such as an AWS Graviton3-based instance
- Basic understanding of C++ and CMake

### Summary

You’ll accelerate random-number generation in a C++ workload on Arm Linux with OpenRNG. First, you’ll build and run the baseline application, then use Arm Performix Code Hotspots to identify expensive functions. You’ll then replace scalar distribution generation with the OpenRNG vector API from Arm Performance Libraries and profile the updated build. Finally, you’ll run a microbenchmark across eight input sizes and compare the baseline and accelerated timings.

### Frequently asked questions

**Which package manager should I use during setup if I'm using Ubuntu or Debian?**

Replace `dnf` with `apt` on Ubuntu or Debian.

**What result should I expect when I run the baseline example?**

You’ll see the number of generated points, the count within a rectangular window, and the shortest distance from the origin across the full distribution. You generate the points by adding Gaussian and uniform distributions. Use this run to establish baseline behavior before profiling and acceleration.

**What should I look for in the Arm Performix Code Hotspots report?**

Focus on `generateDistribution`, the primary hotspot in the example flame graph. You’ll see more time spent in Gaussian sampling with `std::normal_distribution` than in uniform sampling. Prioritize random-number generation rather than `min_length`, which contributes negligible runtime in the example.

**Which OpenRNG API should I use to speed up distribution generation?**

Use the Vector Statistical Library (VSL) API with a stream object to generate values in bulk. This vector approach reduces per-call overhead for random number generation.

**What output indicates the microbenchmark sweep ran correctly?**

The sweep times the isolated distribution generator across eight sizes from 2^8 to 2^15 and reports elapsed time in microseconds. Run both baseline and accelerated builds, then compare timings across sizes to evaluate scaling and improvements.
