# Is there a way to modify expressions in \`Documenter\` to remove \`rng\`

**URL:** <https://discourse.julialang.org/t/is-there-a-way-to-modify-expressions-in-documenter-to-remove-rng/90808>\
**Category:** Tooling\
**Tags:** documenter\
**Created:** [November 25, 2022, 1:48pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-modify-expressions-in-documenter-to-remove-rng/90808 "2022-11-25T13:48:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![t-bltg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/t-bltg/32/25526_2.png) [@t-bltg](https://discourse.julialang.org/u/t-bltg)\
**Post date:** [November 25, 2022, 1:48pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-modify-expressions-in-documenter-to-remove-rng/90808/1 "2022-11-25T13:48:28Z")

</div>

In `PlotDocs`, we use `DemoCards` and `Literate` to generate example plots, and `Documenter` for rendering docs.

I’d like the generated code to take a `rng` argument so that the output is more reproducible.  
So far this works well (I can modify expressions to take a `rng` argument) , but the problem is that I don’t want it to appear in the end user documentation.

For examples, taking [Lines · Plots](https://docs.juliaplots.org/stable/gallery/gr/generated/gr-ref1/#gr_demo_1), this is what I obtain (note the added `rng`):

```julia
using Plots
gr()
Plots.reset_defaults() #hide

using StableRNGs #hide
rng = StableRNG(1234) #hide

plot(Plots.fakedata(rng, 50, 5), w = 3)

# This file was generated using Literate.jl, https://github.com/fredrikekre/Literate.jl

```

Now, I’d like the expression `plot(Plots.fakedata(50, 5), w = 3)` (without `rng`) to appear in the `html` so that it can be copy-pasted by anyone, without having to setup a random number generator.

Is there a way to do that ?

cc @JohnnyChen94, @fredrikekre

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [November 25, 2022, 2:18pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-modify-expressions-in-documenter-to-remove-rng/90808/2 "2022-11-25T14:18:27Z")

</div>

Why you do not setup `rng` in the single place where you write `rng` so the code is both reproducible and is a single line to be copyed?

---

<div class="post-metadata">

**Author:** ![t-bltg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/t-bltg/32/25526_2.png) [@t-bltg](https://discourse.julialang.org/u/t-bltg)\
**Post date:** [November 25, 2022, 2:20pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-modify-expressions-in-documenter-to-remove-rng/90808/3 "2022-11-25T14:20:15Z")

</div>

We use `StableRNGs` (to enforce reproducibility across julia versions) and not everyone has `StableRNGs` in their project.

I’ve edited the example.
