{'fraction_non_alphanumeric': 0.03417435511203163, 'fraction_numerical': 0.012427038222556957, 'mean_word_length': 4.6293057763646, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Quantum Systems for Monte Carlo Methods and Applications to Fractional Stochastic Processes

Random numbers are a fundamental and useful resource in science and engineering with important applications in simulation, machine learning and cyber-security. Quantum systems can produce true random numbers because of the inherent randomness at the core of quantum mechanics. As a consequence, quantum random number generators are an efficient method to generate random numbers on a large scale. We study in this paper the applications of a viable source of unbiased quantum random numbers (QRNs) whose statistical properties can be arbitrarily programmed without the need for any post-processing and that pass all standard randomness tests of the NIST and Dieharder test suites without any randomness extraction. Our method is based on measuring the arrival time of single photons in shaped temporal modes that are tailored with an electro-optical modulator. The advantages of our QRNs are shown via two applications: simulation of a fractional Brownian motion, which is a non-Markovian process, and option pricing under the fractional SABR model where the stochastic volatility process is assumed to be driven by a fractional Brownian motion. The results indicate that using the same number of random units, our QRNs achieve greater accuracy than those produced by standard pseudo-random number generators. Moreover, we demonstrate the advantages of our method via an increase in computational speed, efficiency, and convergence.


Introduction
The motivation for creating an unbiased quantum random number generator is in its wide range of applications in not only secure communication and cryptography, but also in its widespread use in Monte-Carlo (MC) simulations. It is well known that pseudo-random number (PRN) generators are not random at all such that seed-based generators can be used to generate identical strings of random numbers based on the same seed and similar computational systems. Furthermore, it has been shown that the entropy rate also approaches zero when viable random seeds are used up [16].
In contrast, quantum random numbers (QRN) are physically created by quantum processes that are inherently stochastic. That is, one can by no means can predict a sequence of numbers before they are acquired from the source, even if one has full knowledge about the state of the system.
In recent years, many methods have been proposed for QRNs producing a uniform distribution, see e.g. [19], [28]. Compared to other methods of implementation, which focus on high data rate and test suite scores, our approach is notable where we also demonstrate that QRNs can be generated directly in arbitrary probability distributions, with high-dimensionality, and free of post-processing. It is based on the random arrival time measurement of single photons that have temporal wave-forms shaped by an electro-optical modulator [22]. A key application area of such random numbers is for MC simulations for stochastic processes.
An important task in financial and risk engineering is to study stochastic processes [15]. The wide spread use of Monte Carlo simulations of these stochastic processes in enterprise level risk management has led to an ever insatiable need for computing power and speed. The creation of these simulation paths using true random number generators is precisely where these quantum random numbers can play a critical role.
Simulation of stochastic processes in general, and of fractional stochastic processes in particular, is an important problem in engineering and science. A fractional Brownian motion offers a convenient modeling approach for non-stationary and non-Markovian stochastic processes with statistical self-similarity, and makes natural the use of wavelets for both its analysis and synthesis [13]. Fractal feature analysis and classification in medical imagining can be studied by using a fractional Brownian motion, since the fractal dimension in medical images may be obtained from the Hurst exponent [9]. Furthermore, traffic phenomena is connectionless networks can be modeled and analyzed via a fractional Brownian motion [23].
Having the motivation that simulation of fractional stochastic processes and MC techniques are widely applied in science, engineering, and finance, we present in this paper the advantages of using a QRN generator versus its classical counterpart (pseudo-random numbers) for increased computational efficiency and accuracy. Our purpose is to simulate faster and more efficiently stochastic processes that are not analytically tractable.
We begin with a short description of our QRN generator and show the advances of our experimental device as it compares with similar products available in the industry and other research laboratories. We discuss in Section 3 the fractional Brownian motion (fBM) and its properties, present some well-known simulation methods, and compare the outcomes of the simulation via PRNs versus QRNs in terms of speed and performance. Thereafter, we present in Section 4 some relevant applications to fractional stochastic processes. We first discuss the Rough Fractional Stochastic Volatility (RFSV) model from a seminal paper [14] and show the applicability of fractional stochastic processes in volatility modeling in finance. In a similar manner, we define a fractional SABR (fSABR) model and price some path dependent/exotic volatility options under the fSABR model. Finally, we use our QRNs to price these same financial instruments under the fSABR model and compare them to pseudo random number methods. The paper ends with several conclusions and directions for future research.

The Quantum Random Number Generator
Random numbers are key for a wide range of applications, spanning issues like encryption, cryptography, and numerical simulations in physics, biochemistry, molecular biology or finance, see [18], [1]. Classical approaches for generating random numbers (the so-called pseudo-random numbers, which are generated by complex yet deterministic numerical algorithms on classical/nonquantum computers) are often insufficient to meet the growing demands in data security and accuracy, see for instance [10].

Experimental setup
In a recent paper [22], we present a viable source of unbiased quantum random numbers whose statistical properties can be programmed without need for post-processing. The device is based on measuring the arrival times of single photons in shaped temporal modes, as illustrated in Figure   1. We also demonstrate direct generation of genuine QRNs in user-defined, arbitrary distribution functions, with superior statistical properties than existing devices.

NIST and Dieharder tests
To assess the quality of our QRN generator, we first generate a large amount of random numbers. The data (QRNs) contains 2.07732758 × 10 8 random integers in the set n i ∈ [0, 4.294967288 × 10 9 ] ∩ Z, i = 1, 2, . . . , 207732758  The NIST tests [25] and Dieharder tests 1,2 were applied to our QRNs. In order to repeat a test that returns "weak", we used the option -Y 1 in the Dieharder routine, also known as "resolve ambiguity mode". We observed that our QRNs exhibit the desired statistical properties.
NIST and Dieharder tests were applied (see Figure 4 for a summary of results). As it turns out, our QRNs pass all Dieharder tests for randomness, with all the p-values consistently above the significance level with high confidence. Moreover, our QRN generator can produce samples with any preassigned distribution as illustrated in figure 5, where we show the histograms of QRNs in a modified Bessel distribution and an arbitrary distribution, respectively.
We present in Table 1   Furthermore, the functionality of our device can be extended to ensure secure encryption, fast communication, and more reliable and efficient Monte Carlo simulations.

Fractional Brownian motion
We present in this section some well-known properties of the fractional Brownian motion (fBM), and we implement several simulation algorithms using both pseudo and quantum random numbers.

Properties
Let W t and B t , t ≥ 0 be two independent Brownian motions (fBM), and denote with W H t and B H t the fBMs driven by W t and B t , respectively. By definition, a fractional Brownian motion (fBM) with Hurst parameter H ∈ (0, 1) is a zero mean Gaussian process W H = {W H t , t ≥ 0} with a temporal covariance function given by This process was first introduced by Kolmogorov in [17] and later studied by Mandelbrot and Van Ness in the pioneering work [20]. The fBM is defined via the following stochastic representation:     where {W s , s ≥ 0} is a Brownian motion and Γ(·) represents the Gamma function. Note that W is recovered by taking H = 1 2 in (2). We further remark that this representation in terms of an integral with respect to Brownian motion is non-unique; see e.g. [26]. A representation in terms of the Molchan-Golosov kernel will also be used in the sequel. That is, where K is the Molchan-Golosov kernel with , and F is the Gauss hypergeometric function.
It can be shown that a normalized fractional Brownian motion {W H t } t≥0 with H ∈ (0, 1) is uniquely characterized by the following properties: From (1)

Simulation and comparison
A plethora of methods are available for simulating sample paths of fBMs, and we refer the reader to [12] for a good review of properties and algorithms. Let such that t 0 < t 1 < · · · < t n be a partition of the fixed time interval [0, T ]. We consider here two methods for testing purposes: (i) The Davies and Harte method for generating fBM samples {W H t0 , W H t1 , . . . , W H tn } on the partition Π was implemented. The algorithm was originally proposed by [11] and it is presented in detail in Section 2.1.3 of [12].
(ii) The hybrid scheme for Brownian semistationary processes given in [5] was used to generate sample paths for fBMs {B H t k , k = 0, 1, 2, . . . , n} using the Molchan-Golosov kernel. The algorithm is based on discretizing the stochastic integral representation of the process in the time domain. More recently, [21] considered methods for turbocharging Monte Carlo pricing under the so-called rough Bergomi model.
In order to evaluate the algorithms, several test routines calculating moments and errors for fractional processes have been implemented: mean µ and variance v as a function of time via Monte Carlo simulations, a chi-square test for fractional Gaussian noise [12], [6], as well as the 2D correlation structure γ M C via sample paths: where k, j = 0, 1, 2, . . . , n and N is the number of MC paths. The results are presented in Figure 6 (Davies and Harte method), and Figures 7 and 8 (hybrid scheme). By inspection, we notice that the generated sample paths have the required properties that are specific to fBMs.
We employ now for comparison purposes the same simulation methods using this time QuEST QRNs. Fractional BM paths are generated via the hybrid scheme using both QRNs and PRNs.
Statistical properties for sample fBM paths using both PRNs and QRNs are shown in Figure 9.
To measure our QRNs performance, we introduce the following errors:  Note that ε i , i = 1, 2, 3 are the root mean squared errors with respect to the first two moments and covariance in time of our simulated fBM paths. We present in Table 2 the errors for different numbers of MC paths N and different source of randomness (quantum versus classical). The corresponding plots are given in Figure 10. We note that the QRN rate of convergence is superior to its classical counterpart, thus yielding similar performance with less random samples. Moreover, it is clear that the execution time is smaller when using QRNs, since no post-processing algorithm is applied (as opposed to PRNs, where Box-Muller or Ziggurat transformations need to be applied) and the random numbers are fed in real-time to the path generation algorithm. The function ε 3 (N ) is almost constant, but we note once again that QRNs provide superior results.

Applications to fractional stochastic processes
We discuss now some interesting applications of our QRNs in financial engineering: the rough fractional stochastic volatility model and pricing of a volatility dependent option assuming the fractional SABR model.

The Rough Fractional Stochastic Volatility model
The analysis presented in this section is based on [14], where the authors propose the so-called Rough Fractional Stochastic Volatility (RFSV) model, which was shown to be compatible with the empirical smoothness of volatility in financial markets. Moreover, it was shown via empirical analysis that the log-volatility process estimated from high-frequency financial data behaves like a fBM with Hurst exponent of order 0.1.    Consider the following model from [14]: with m ∈ R, and α, ν, σ 0 as positive parameters. Note that by choosing the fractional Ornstein-Uhlenbeck process (fOU) for the log volatility above ensures a stationary model. Recall that the fBM can be alternatively characterized by: for any t ∈ R, ∆ ≥ 0, q > 0, where K q is the q th -moment of the absolute value of a standard Gaussian variable.

Full circle calibration and estimation
We implement now a full circle calibration and estimation analysis of the RFSV model, which can be summarized in the following steps: (i) Initialize the parameters and simulate one path of fBM using QuEST QRN generator.
(ii) Construct one path for a stationary fOU process {X t } t≥0 and for the fractional stochastic volatility process {σ t } t≥0 given in (10).
(iii) Compute the function m(q, ∆) defined as: The plot of log m(q, ∆) versus log ∆ for different values of q is given in Figure 11.
(iv) Note that for a given q, the points lie on a straight line. Thus the log volatility increments have the following scaling property in expectation: where ζ q > 0 is the slope associated with q. Compare this with (11) and further note that ζ q is linear with respect to q, i.e. ζ q ∼ qH. Thus the slope of this line is the Hurst parameter.
From our simulations, we obtained H = 0.1354 (in order to generate the sample path, we used H = 0.14).
(v) We estimate the Hurst parameter from log σ t samples via difference variance method and the Peng method, see [12]. We obtain H = 0.1121 and H = 0.1385, respectively. The results are plotted in Figure 12. We obtain H = 0.1121 and H = 0.1385, respectively (the true value is H = 0.14).

Empirical Analysis
We repeat the analysis from above for several well know equity indices and market indicators: S&P500, DAX30, Swiss Market Index, and the NASDAQ100. We use precomputed realized variance estimates from the Oxford-Man Institute of Quantitative Finance Realized Library (OMIQF) 5 . The results are given in Figures 13 to 15. Note that we always obtain H < 0.5 (of order 0.1) thus confirming the results in [14]. We also present in Figure 17 a sample path of the RSFV model-generated volatility together with a graph of DAX volatility. It can be noted by simple visual inspection the striking similarity between the paths. We observe that while some data points of the function m(q, ∆) for fixed q may have a poorer linear fit, the main conclusion is always the same: H < 0.5, thus confirming the rough nature of the stochastic volatility process.
Furthermore, we implement our own procedure for estimating the realized volatility based on daily prices, which we obtain from the Bloomberg terminal. Let 0 = t 0 < t 1 < · · · < t n = T be a partition of the time interval [0, T ] into n equal segments of length ∆t, i.e., t i = iT n for i = 0, 1, . . . , n. The majority of traded contracts define realized variance to be [7]: for n return observations, where AF is the annualized factor usually set to AF = 252. V d (0, n, T ) is called the discretely sampled realized variance from 0 to T > 0. We implement the formula above for SPX, DAX, NASDAQ, and the Swiss Market Index. Our data consists in daily closing prices from August 16 2000 to August 16 2017. The results are plotted in Figure 18.Our results are consistent with the live data for realized variance from the Oxford-Man Institute for Quantitative Finance. Further, we implemented the procedure described above for estimating the Hurst exponent using our own computed realized volatility. Once more, the results are consistent with the previous experiments.
Let V c (0, T ) be the so-called continuous realized variance where one has Furthermore, assuming a stochastic volatility model σ t , t ≥ 0, it can be proved that the continuous realized variance is given by: Similar to [14], we conclude from our market analysis that the volatility is indeed rough, i.e., can be successfully modeled as an exponential of a scaled fBM. Estimation of the Hurst parameter, which is essential to the nature of fBMs, turns out to be reliable, robust, and numerically efficient.

The lognormal fractional SABR model
The price of underlying asset S t and its instantaneous volatility α t in the lognormal fSABR model are governed by the following stochastic differential equation: where B t and W t are independent Brownian motions, ρ = 1 − ρ 2 , and B H t is the fractional Brownian motion driven by B t . For fixed K > 0, we define X t = log St K and Y t = α t . Then we have In [2] the authors derive a bridge representation for the joint transition probability density p(t, x t , y t |x 0 , y 0 ) of (X t , Y t ) from fSABR. Furthermore, the authors have also shown that their bridge representation can be regarded as a generalization of the McKean kernel density with respect to the Riemannian volume from 1

Target Volatility Options Pricing via Quantum Random Numbers
We price target volatility options (TVO) under a fBM stochastic process via MC methods using the QRNs described in the previous sections. A similar problem was approached in [3], where the authors derived two analytic approximations of TVO prices. The Python implementation using PRNs (similar to our MC pricing presented here) is available online on the GitHub platform 6 .
We indicate here that our method is more efficient from a numerical point of view than its classical counterpart using pseudo-random numbers generated on a classical computer. The fSABR model is used where fBM paths are generated using both QRNs and PRNs.
A target volatility (TV) call struck at K > 0 pays off at expiry T > 0 the amount where σ > 0 is the (preassigned) target volatility level and ∀x ∈ R, (x) + := max{x, 0}. Note that, if at expiry the realized volatility is higher (lower) than the target volatility, the payoff is scaled down (up) by the ratio between target volatility and realized volatility. For t ≤ T , the price at time t of a TVO call struck at K with expiry T is hence given by the conditional expectation under the risk neutral probability Q as provided the expectation is finite. Finally, we price both TVO call options and the following new contract type called a target volatility put option, having the payoff: Note that the target volatility is in the denominator instead of the numerator, see [3] for comparison. MC methods via PRNs and QRNs were implemented and the results are shown in Figures   19 and 20. Note that once again, we observe more accurate pricing using QRN generated MC paths. Specifically, Figure 19 compares the convergence a MC simulation based on QRNs using 25k paths versus MC PRNs using 100k paths. Figure 20 shows faster convergence of MC QRN as a function of the number of MC paths N . We conclude that by using QRNs, MC simulations for TVO pricing become far more efficient than its classical counterpart.

Conclusions and future research
In this paper, we showed a novel use of quantum random numbers for simulating stochastic processes. The photonic quantum system used here produced truly random numbers that passed all standard randomness tests such as NIST and Dieharder. Furthermore, the efficiency, accuracy, and execution time of our QRNs were demonstrated by the rapid convergence and robustness of using these numbers to simulate fractional Brownian motion -a highly nontrivial stochastic process being both non-Markovian while maintaining strict scaling properties. Finally, we successfully priced target volatility options under the fractional SABR model, a relevant and interesting application for both academics and quantitative finance practitioners.
The results of this paper can be easily generalized: we conjecture that QRN MC trials for path dependent-exotic options and multi-asset correlated options will turn out to be computationally less expensive and more accurate. Some future applications include: (i) multi-dimensional correlated simulation paths following arbitrary distributions may be efficiently created via the quantum methods described in this paper; (ii) the paths generated in (i) are crucial for pricing both multi-asset derivatives but more importantly, for use in the risk analysis for large portfolios of such options [8]; (iii) enterprise wide regulatory risk calculations (Basel III, CVA, XVA, etc., see [8]) require and enormous amounts of multi-dimensional correlated simulation paths following arbitrary distributions. QRN will show their true strength under such pricing scenarios which is a future research.