Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1260
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Can you tell me what to write to get random 6-digit numbers?
And what was the result? I'm not claiming infallibility...))
As a result I had to leave it as there were less than 6 characters
if(v>=min && v<=max)
I'll try it tonight.
The 5-digit ones slip through
Anyway, problem solved, thank you all!
5-digit numbers are slipping through
Yeah, they will.
thought it was only a 6-digit challenge.
as an option to generate the first digit with rand()%10
Yes they will.
thought that the task is only no more than 6 digits
as an option to generate the first character with rand()%10
Put it back in the code.
if(v>=min && v<=max)
that's enough, the function is called a couple times a day anyway
Put it back in the code.
that's enough, the function is called a couple of times a day anyway.
no
simpler way
write it that way
no
It's simpler than that.
so write it down.
Well, you could randomly dial each sign (six pieces) and collect the number)
Well, you could randomise each character (six pieces) and collect the number)
Yes, but it would probably be a bad rand - you need to test
I think, it is easier to shift 16-bit rand() and add more rand() to low bits = get 32-bit - my example rand_32()
Yes, but it would probably be a bad rand - I need to test
I think it's easier to shift a 16-bit rand() and add another rand() to the low bits = get a 32-bit rand_32() - my example
I agree. Either test or tweak the generator logic, which is usually more expensive than the task.
I agree. It's either testing or tinkering with the generator logic, which is usually more expensive than the task at hand.
)