How to check with Random Range If Exits (Float)
Hello guys, how i'm generating float number with Random.Range it's okay. I need to check if it's exists but more different.
float Rnd = Random.Range(1.0f, 5.0f);
In here if i generate number like 1.1f and 1.8f what is difference now. It's 0.7F (1.8f - 1.1f). I need to check next generated number have 0.7F difference this number will add self +1.0F.
1. First Number Generated = 1.2F
2. Second Number Preparing to Generate.
3. Second Number Generated = 1.9F
4. 1.9F - 1.2F = 0.7F. Difference is 0.7F
5. 1.9F added +1.0F self. New Number is 1.9F + 1.0F = 2.9F
6. Second Number Fixed And Generated = 2.9F.
7. Next Steps Same Logic.
I wish to explained it. Thanks.
Anyone can help please on this too please. Why nobody don't answer my questions...
I moved the question into the help room since it doesn't seem to be about Unity at all. It seems more a pure mathematical problem. However I barely understand what you're actually asking here.
Your 7 steps do not follow any reasonable logic. You point out that the the difference between your first and second number is 0.7 but you don't do anything with that difference. In step 5 you just add 1 to your second random number. You say repeat the same logic... To do what? Do you want to generate a longer sequence of numbers? From your steps it's completely unclear what properties those numbers should have.
Note that if you always use the range 1f to 5f for both numbers, it's not guaranteed that the second number is larger than the first one. If you have specific ranges in $$anonymous$$d, you should simply use the proper ranges when you call Random.Range.
There seems to be a high language barrier, so it's really hard to understand what you're asking. You really need to edit your question and be more specific about what exact behaviour you want. Otherwise we have to close this question as it's simply not clear enough to be answered properly
I'm generating objects with instatiate. The problem is i'm using Random.Range for position and same numbers calling 2-3 times. So object on the top object. That's my problem.
I think this algrotim for this problem. So my main problem this one; @Bunny83 https://answers.unity.com/questions/1697828/how-to-instatiate-with-space-by-order.html
Your answer
![](https://koobas.hobune.stream/wayback/20220612222924im_/https://answers.unity.com/themes/thub/images/avi.jpg)