Solved
Random values not different
I need two random numbers in a specified interval. I generate them inside a method using the Unity random class . After the first generation everytime I call the method the numbers don't change. How can I make them change every time i call the method? Sorry for my bad English Thanks in advance
Answer by jkramar · Aug 12, 2016 at 07:56 PM
You would need to post some code to be sure, but you might be using the Random incorrectly.
Quoting from the help page:
The random number generator is not truly random but produces numbers in a preset sequence (the values in the sequence "jump" around the range in such a way that they appear random for most purposes).
See here for more details.
Answer by CatoMaior · Aug 12, 2016 at 08:11 PM
void Start() { int posX = Random.Range(xmin, xmax); int posZ = Random.Range(zmin, zmax); }
This is the method. I'm not sure this is well formatted... If it's not well formatted, how can I do it? Sorry for theese silly questions, but I'm new on the forum
Follow this Question
Related Questions
Random Number every 5 seconds 2 Answers
Help with Randomized Sprite on GUI button click 0 Answers
Randomly generate blocks on a flat map 0 Answers
Generate Random sequence of color sprites 0 Answers
Random Scenes Without Repetition 1 Answer