- www.mql5.com
int xxx= int((9 * MathRand()) + 1);
By the way, your function does not create a 10 digit code. It generates a value between 1 and 294904, which is at most 6 digits (1 digit in the least).
- www.mql5.com
I'm not sure what you mean by "without repeating numbers". If you mean always generating a unique password every time, then you could try also including the date and time to make it more unique and then just encrypt it.
I'm not sure what you mean by "without repeating numbers".
I have
0123456789
and plan to scramble these number.
"thanks for early response".
Then do exactly that, jumble up the sequence of the characters in that string "0123456789".
How are you doing it in your Visual Studio project?
You did not mention in what language, but whatever the language I will assume you are just manipulating a string and jumbling up the sequence of the characters in a random way.
Just replicate that in MQL using the MQL string manipulation functions.
Then do exactly that, jumble up the sequence of the characters in that string "0123456789".
How are you doing it in your Visual Studio project?
You did not mention in what language, but whatever the language I will assume you are just manipulating a string and jumbling up the sequence of the characters in a random way.
Just replicate that in MQL using the MQL string manipulation functions.
attached are vs.
ok I try to explore
manipulating a string with MQL5 codes.
But if you guys have an idea of what I needs please post your code. thanks in advance
You can basically do it in the same way as your Visual basic code. Just remember that the functions in MQL work differently so check the documentation.
For example MathRand() returns an integer between 0 and 32767 and not a double between 0.0 and 1.0, so adjust the code accordingly.
Guys happy coding and Trading.
I would like to ask your ideas and knowledge on how to get the above SUBJECT.
I have that module when I doing my visual studio project. But here in mql5 I don't know how.
I try to google for 2days but nothing happen.
The scenario:
my EA are completely finish and functional. I would like to put a password.
I would like to GENERATE a 10digit PASSWORD without repeating numbers.
i using Mathrand() but not meet the needs.
Question:
Is there a possibility to meet my needs by using MQL5 codes?
if possible can I ask here your guides on how to code that?
-Thank you for your reading ang time to my concern.
Why your passwords need to be that way? You know that they will be lame, right?
void getRandom(int &val[10]) { bool used[10]; for(int i = 0; i < 10; i++) used[i] = false; for(int i = 0; i < 10; i++) { MathSrand(GetTickCount()); while (true) { int x = (int)MathRand() % 10; if (used[x] == false) { used[x] = true; val[i] = x; break; } } } } void OnStart() { int val[10]; getRandom(val); string password = ""; for(int i = 0; i < 10; i++) password += IntegerToString(val[i]); Print(password); } //+------------------------------------------------------------------+good luck.
a simple "not optimized" code might look like this:
good luck.
I am very thankful for sharing your codes. two thumbs up for your kindness.
Then do exactly that, jumble up the sequence of the characters in that string "0123456789".
How are you doing it in your Visual Studio project?
You did not mention in what language, but whatever the language I will assume you are just manipulating a string and jumbling up the sequence of the characters in a random way.
Just replicate that in MQL using the MQL string manipulation functions.
thanks foe these "just manipulating a string and jumbling up". My EA are now completely finished.
PROBLEM SOLVED.
//+------------------------------------------------------------------+ //| Password Generator / code gate | //+------------------------------------------------------------------+ void pwG()//Code Gate { int x = (int)MathRand() % 10; if((x==0)&&(a==9)) { a=x; if(StringLen(nPW)<=10) {StringAdd(nPW, IntegerToString(0));} }
see attached.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Guys happy coding and Trading.
I would like to ask your ideas and knowledge on how to get the above SUBJECT.
I have that module when I doing my visual studio project. But here in mql5 I don't know how.
I try to google for 2days but nothing happen.
The scenario:
my EA are completely finish and functional. I would like to put a password.
I would like to GENERATE a 10digit PASSWORD without repeating numbers.
i using Mathrand() but not meet the needs.
Question:
Is there a possibility to meet my needs by using MQL5 codes?
if possible can I ask here your guides on how to code that?
-Thank you for your reading ang time to my concern.