Hello~
I need to get random numbers from 0 to 15 in the output whenever an event occurs.
I'm not a programmer, I'm not good at C#.
So I haven't solved this problem for weeks.T.T TTTTTTT
I tried to solve it on my own, but I can't.
Please somebody help me~!!!
PS. Please send a sample vza to my email.
sun6_6@owr.co.kr
Hello Ventuzians!
THE FORUMS ARE CLOSED!
Please join our discord server HERE!! << click me
We are shutting our Ventuz Forum, but don't worry, it will all be archived for you to search in if you have a query. From now on, please add all your comments, questions or observations into our Discord Server
Thanks for the great time - see you on discord!!
Dee, Karol, Daniel and the whoooole Product and Support team!
THE FORUMS ARE CLOSED!
Please join our discord server HERE!! << click me
We are shutting our Ventuz Forum, but don't worry, it will all be archived for you to search in if you have a query. From now on, please add all your comments, questions or observations into our Discord Server
Thanks for the great time - see you on discord!!
Dee, Karol, Daniel and the whoooole Product and Support team!
I need to get random numbers from 0 to 15 in the output. Help me~T.T
Moderator: Support
Re: I need to get random numbers from 0 to 15 in the output. Help me~T.T
Hello Nangdo,
the easiest way i can think of achieving this, without the need of any C#. Is the Mover node. Take a look in the functions, there is a Random mode. Which will give you Random numbers of the min Max value you set up. And if you dont like the float thats coming out of it, just bind a Integer Value node to it.
I bet there will be other ways too, but this should be the fastest to achieve.
Greetings
Jan
the easiest way i can think of achieving this, without the need of any C#. Is the Mover node. Take a look in the functions, there is a Random mode. Which will give you Random numbers of the min Max value you set up. And if you dont like the float thats coming out of it, just bind a Integer Value node to it.
I bet there will be other ways too, but this should be the fastest to achieve.
Greetings
Jan
Re: I need to get random numbers from 0 to 15 in the output. Help me~T.T
Yes, the mover node is all you need.
You're writing numbers 0..15, so I assume you want integers and not floats, so 1, 2, 3, ... and not numbers like 3.14? See A) The Mover will give you floats - so we need to do an additional step here. If you 're looking for floats, see B)
A) you want integers 0..15
1. Add a mover node and set its Function to Random. Set the Mode to OneStep. Now you can trigger the Nudge event to generate a new random number. See attached image.
2. Set the Min to 0 and the Max to 15.999. This is important as explained below. [1]
3. Convert your float to int. This is done implicitely by passing the Mover's output into any input that is an integer. But we can also do this explicitely by using an integer Expression. Just add one and pipe the Mover's output into the expression's input A. Now you could put this into a content container, expose the nudge event and the integer expression's output. Bäm. [2]
[1] Why we use 15.999 as max: If you set it to 15, the mover will also generate the number 15. But converting the float to int will basically truncate the number. So anything in the range 0..<1 will become 0 - like 0.1, 0.6, 0.97. The probability is the same for 0, 1, 2, ... up to 14. However, 15 would not occur at the same probability, as we only have the exact value 15. We don't have a range 15..<16. By using 15.999 we give 15 (almost) the same range and therefore probability as the other numbers.
[2] An integer node would also work, but then we'd need to bind other nodes to the integer's input, as it has no integer output. Binding might bind to the changed event, so the workflow is more error-prone.
B) you want floats 0..15
1. Add a mover node and set its Function to Random. Set the Mode to OneStep. Now you can trigger the Nudge event to generate a new random number. See attached image.
2. Set the Min to 0 and the Max to 15.
You're writing numbers 0..15, so I assume you want integers and not floats, so 1, 2, 3, ... and not numbers like 3.14? See A) The Mover will give you floats - so we need to do an additional step here. If you 're looking for floats, see B)
A) you want integers 0..15
1. Add a mover node and set its Function to Random. Set the Mode to OneStep. Now you can trigger the Nudge event to generate a new random number. See attached image.
2. Set the Min to 0 and the Max to 15.999. This is important as explained below. [1]
3. Convert your float to int. This is done implicitely by passing the Mover's output into any input that is an integer. But we can also do this explicitely by using an integer Expression. Just add one and pipe the Mover's output into the expression's input A. Now you could put this into a content container, expose the nudge event and the integer expression's output. Bäm. [2]
[1] Why we use 15.999 as max: If you set it to 15, the mover will also generate the number 15. But converting the float to int will basically truncate the number. So anything in the range 0..<1 will become 0 - like 0.1, 0.6, 0.97. The probability is the same for 0, 1, 2, ... up to 14. However, 15 would not occur at the same probability, as we only have the exact value 15. We don't have a range 15..<16. By using 15.999 we give 15 (almost) the same range and therefore probability as the other numbers.
[2] An integer node would also work, but then we'd need to bind other nodes to the integer's input, as it has no integer output. Binding might bind to the changed event, so the workflow is more error-prone.
B) you want floats 0..15
1. Add a mover node and set its Function to Random. Set the Mode to OneStep. Now you can trigger the Nudge event to generate a new random number. See attached image.
2. Set the Min to 0 and the Max to 15.
- Attachments
-
- r2.jpg (2.89 KiB) Viewed 4654 times
-
- Mover settings
- r1.jpg (16.21 KiB) Viewed 4654 times
Re: I need to get random numbers from 0 to 15 in the output. Help me~T.T
Feel free to use !
Input :
Here you can customize range and
use Randomize to generate random int from this range.
Output :
Here you have the randomized result.
Input :
Here you can customize range and
use Randomize to generate random int from this range.
Output :
Here you have the randomized result.
- Attachments
-
- Randomize.vzs
- (7.11 KiB) Downloaded 282 times