TensorTom

Pseudo Random Number Generator

This is my first attempt at a psuedo-random number generator in Pine. It is, as you can see, a failed attempt thus far. I began by trying to implement the random color generator as described here: https://www.tradingcode.net/tradingview/colours/random-colours/ in version 3 Pine (Not sure which version he was using). As you can see, the color isn't random.

The end goal here is to be able to get pseudo-random numbers for use in algorithms that require them, of which there are a significant few. Perhaps numbers aren't required so long as I can map colors to other data. We'll see. This is a work-in-progress and I encourage anyone who can help to do so. Algorithmically, the importance of being able to use random data can't be overstated.
Release Notes: switched x to outside the function as in the example this is derived from.
Release Notes: It now works!!! It was actually a simple fix. A huge thanks to Julia P. from TradingView Support. Now the real magic begins.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Comments

Good job guy! Thank you for public this script.
Reply
Home Stock Screener Forex Screener Crypto Screener Economic Calendar About Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Private Messages Chat Sign Out