title: Updating a random value in a Shiny UI input parameter every time the output is updated
body: <p>This is a totally gratuitous use case, though I think I will learn something valuable from the answer :)</p>
  <p>I want to show a random gif (randomly drawn from a list of pre-selected urls) while a shiny app loads the output.</p>
  <p>I am using the <code>shinycssloaders</code> package to put in a spinner while the output loads, and feeding it an image from that list of urls. Below, the out-of-the-box histogram sample app with the spinner and some gif urls.</p>
  <p>The gif url only appears to be sampled each time the app is loaded. I want it to re-select every time the output activities run (sorry if I'm butchering the technical terms here). My real app uses an <code>actionButton</code> with <code>eventReactive</code> so that the output only re-loads when the button is clicked.</p>
  <p>Here's sample code that can be run. It sleeps for 3 seconds before loading the histogram after each input change in order to show the gif.</p>
  <pre><code>library(shiny)
  library(shinycssloaders)
  
  gifs &lt;- c(
      &quot;https://media.giphy.com/media/QPQ3xlJhqR1BXl89RG/giphy.gif&quot;, 
      &quot;https://media.giphy.com/media/26n6xBpxNXExDfuKc/giphy.gif&quot;, 
      &quot;https://media.giphy.com/media/lP4jmO461gq9uLzzYc/giphy.gif&quot;   
  )
  
  # Define UI for application that draws a histogram
  ui &lt;- fluidPage(
  
      # Application title
      titlePanel(&quot;Old Faithful Geyser Data&quot;),
  
      # Sidebar with a slider input for number of bins 
      sidebarLayout(
          sidebarPanel(
              sliderInput(&quot;bins&quot;,
                          &quot;Number of bins:&quot;,
                          min = 1,
                          max = 50,
                          value = 30)
          ),
  
          # Show a plot of the generated distribution
          mainPanel(
              withSpinner(
                  plotOutput(&quot;distPlot&quot;), image = sample(gifs, 1)
              )
          )
      )
  )
  
  # Define server logic required to draw a histogram
  server &lt;- function(input, output) {
  
      output$distPlot &lt;- renderPlot({
          # generate bins based on input$bins from ui.R
          x    &lt;- faithful[, 2]
          Sys.sleep(3)
          bins &lt;- seq(min(x), max(x), length.out = input$bins + 1)
  
          # draw the histogram with the specified number of bins
          hist(x, breaks = bins, col = 'darkgray', border = 'white')
      })
  }
  
  # Run the application 
  shinyApp(ui = ui, server = server)
  </code></pre>
  <p><strong>Session Info:</strong></p>
  <pre><code>R version 4.1.1 (2021-08-10)
  Platform: x86_64-w64-mingw32/x64 (64-bit)
  Running under: Windows 10 x64 (build 22000)
  
  Matrix products: default
  
  locale:
  [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
  [4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
   [1] shinycssloaders_1.0.0 RODBC_1.3-18          shinythemes_1.2.0     DT_0.19               forcats_0.5.1        
   [6] stringr_1.4.0         dplyr_1.0.7           purrr_0.3.4           readr_2.0.1           tidyr_1.1.4          
  [11] tibble_3.1.4          ggplot2_3.3.5         tidyverse_1.3.1       shiny_1.6.0          
  
  loaded via a namespace (and not attached):
   [1] Rcpp_1.0.7        lubridate_1.7.10  here_1.0.1        assertthat_0.2.1  rprojroot_2.0.2   digest_0.6.27    
   [7] utf8_1.2.2        mime_0.11         R6_2.5.1          cellranger_1.1.0  backports_1.2.1   reprex_2.0.1     
  [13] httr_1.4.2        pillar_1.6.2      rlang_0.4.11      readxl_1.3.1      rstudioapi_0.13   jquerylib_0.1.4  
  [19] htmlwidgets_1.5.4 bit_4.0.4         munsell_0.5.0     broom_0.7.9       compiler_4.1.1    httpuv_1.6.3     
  [25] modelr_0.1.8      janitor_2.1.0     pkgconfig_2.0.3   htmltools_0.5.2   sourcetools_0.1.7 tidyselect_1.1.1 
  [31] fansi_0.5.0       crayon_1.4.1      tzdb_0.1.2        dbplyr_2.1.1      withr_2.4.2       later_1.3.0      
  [37] grid_4.1.1        jsonlite_1.7.2    xtable_1.8-4      gtable_0.3.0      lifecycle_1.0.0   DBI_1.1.1        
  [43] magrittr_2.0.1    scales_1.1.1      cachem_1.0.6      cli_3.0.1         stringi_1.7.4     vroom_1.5.4      
  [49] fs_1.5.0          promises_1.2.0.1  snakecase_0.11.0  bslib_0.3.0       xml2_1.3.2        ellipsis_0.3.2   
  [55] keyring_1.2.0     generics_0.1.0    vctrs_0.3.8       tools_4.1.1       bit64_4.0.5       glue_1.4.2       
  [61] crosstalk_1.1.1   hms_1.1.0         yaml_2.2.1        rsconnect_0.8.24  fastmap_1.1.0     colorspace_2.0-2 
  [67] rvest_1.0.1       haven_2.4.3       sass_0.4.0   
  </code></pre>