Generate C code implementation for random passwords and c code
Problem description
Some software often requires the user to enter a random password (or verification code) sent by the system during login to verify the user's identity and prevent malicious login.
A 6-digit random password string must be generated in C language.
Rand Functions
The rand function is a real random number generator. It returns a random value ranging from 0 to RAND_MAX (2147483647.
This function is prototype: int rand (void );
When using this function, you must include the header file "stdlib. h ".
C code implementation
Makefile content
TestRand: TestRand. c
Gcc-c-g TestRand. c
Gcc-g-o release/TestRandTestRand. o
Rm *. o
Random Password generation
After executing the "make" command, go to the "release" directory and run the "TestRand" command. The generated random password is as follows:
289383
930886
692777
636915
747793
238335
885386
760492
516649
641421
202362
490027
368690
520059
897763
513926
180540
383426
089172
455736
(My microblogging: http://weibo.com/zhouzxi? Topnav = 1 & wvr = 5, No.: 245924426, welcome !)