Hihi
I need to create a 4 digit random number, however when I used new random().Next(0000,9999) this also generated results such as 123/ 25. I need it to start with 0123 or 0025 - to get 4 digits. Any idea how to do this? I tried formatvalue but that does not seem right.
Thank you!
Have another variable make it constant with what number you need then Concatenate it with actual generated
var Const = 0123
and new random().Next(00,99)
Thanks,
Prankur
kantheshm
(Kanthesh Mallesh)
January 5, 2019, 6:56am
3
Hi @donutlearns ,
Your question seems to be interesting, i have tried this and got the result.
The one thing i did was i have generated random number from 0000-9999 and took the resulted value concatenated with β0000β to the left.
and finally i used substring and took last 4 digit number.
I think this is what you were looking at.
Summerized:
Random number-23
concatenate string-0000
Result=000023
Final result=0023
Thank You
Regards,
Kanthesh
P.S- If you require a solution workbook please ping me.
Hello,
I have attached a working solution.
.Random.xaml (6.0 KB)
1 Like
Thanks @kantheshm
I did not think of it this way! Nice.
Thanks @Anusha_Makam
This is exactly right! Awesome!
kantheshm
(Kanthesh Mallesh)
January 5, 2019, 7:51am
7
I think @Anusha_Makam has tried my logic and got right,
Appreciate it.
Hi @donutlearns ,
Mark your question as answered with a solution marked,so that others can find solution and try that out.
Regards,
Kanthesh
hi
i am using random function {"new random().next(1,100) " } ,but itβs generated duplicate numbers ? please help me
my requirement is " excel file column A is their 100 values " so robot take the random value from column A ?
ZaiHao
(ZaiHao)
May 29, 2020, 2:32am
10
Hi,
Padleft should be able to help.
new random().Next(0,9999).ToString.padleft(4,CChar(β0β))
Best Regards,
ZaiHao
1 Like