How to get random numbers into Yahoo Pipes?

In what follows I will present two methods for obtaining random numbers inside a Yahoo Pipes setup. The first method is based on obtaining the current timestamp and using it your random number. The advantage of this method is that it is quick (you don’t need to access third-party websites). This disadvantage is that it’s not that random – somebody reading your feed can figure out the algorithm and possibly predict future values. If this a problem for you, take a look at the second method.


The flow is as follows:

  • from the first element you get the date/time at the time of the feed “evaluation” (this might differ from the time the feed is fetched)
  • the second step is to format it as a timestamp (number of seconds since 00:00:00 UTC on January 1, 1970), which also has the side-effect of creating a single number
  • the third step is to normalize it. Taking modulo 100 means that the number will always be between 0 and 99. If you need an interval not starting at 0, just add an other steps which “shifts” the lower end of it (for example: if you need numbers between –150 and –100, you would implement the following expression: –150 + (timestamp % 50))

Now for the second version: this is based on the REST API. Simply fetch the URL which outputs the random numbers as a CSV file:


The advantage of this method is that it is fairly easy to obtain high-quality  random numbers in large quantities. The disadvantage is that they might ban Yahoo pipes at one moment if too many people start using the service (since they state on their site that: “If you access RANDOM.ORG via an automated client, please make sure you observe the Guidelines for Automated Clients or your computer may be banned.” – and you have little control over the method the Pipes backend uses to fetch the data)

3 responses to “How to get random numbers into Yahoo Pipes?”

  1. I can't find any way to find a way to output CSV on Also, your example creates a feed of sorts – how would i go about using those random numbers to modify my other feed items – like sorting feed items by random number?


  2. @meeble: there isn't an option to output the results on as a CSV file, but if you go to advanced mode and select "Format 1 column(s)" and "As a bare-bones text document (type text/plain)", it resembles a CSV file close-enough so that the CSV loader from Yahoo Pipes doesn't complain.

    As for joining two data sources (the random data and the feed), I don't have a solution at the moment (it is something I'm still researching). One idea would be to use YQL with the pipe, however I didn't researched that option, so I can't say for sure if it will work.


Leave a Reply

Your email address will not be published. Required fields are marked *