# Using LSTM to predict Random Numbers from Java's Random() class

**URL:** <https://community.konduit.ai/t/using-lstm-to-predict-random-numbers-from-javas-random-class/1098>\
**Category:** Tuning Help\
**Created:** [January 3, 2021, 9:49pm UTC](https://community.konduit.ai/t/using-lstm-to-predict-random-numbers-from-javas-random-class/1098 "2021-01-03T21:49:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sqljunkey](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/sqljunkey/32/419_2.png) [@sqljunkey](https://community.konduit.ai/u/sqljunkey)\
**Post date:** [January 3, 2021, 9:49pm UTC](https://community.konduit.ai/t/using-lstm-to-predict-random-numbers-from-javas-random-class/1098/1 "2021-01-03T21:49:04Z")

</div>

Hi, I was interested to try using LSTM to predict Random numbers from Java’s Random class. I use random.getNextDouble() which gives you a random number between 0 and 1. I put these results in one sequence file for the features, and the next number from the sequence in a target file. I trained the network on this data and then evaluated with regression. What I find is the Rsquared is low etc. Am I doing something wrong here? Is it even possible to do this with random data?

This is the code: [import org.bytedeco.opencv.opencv\_face.FacemarkAAM;import org.datavec.api.re - Pastebin.com](https://pastebin.com/cHfh9GP8) (which is just one of the examples updated to work)  
This is the code for the random generator: [import lombok.val;import org.apache.commons.io.FileUtils;import java.io. - Pastebin.com](https://pastebin.com/Fb4EpaGf)

Thanks
