0

Hi friends,
I am making a project on cyber cafe and i want to generate username and password automatically on different clicks.

I am using txtusername.text=cstr(int(rnd()*1000))
It gives random numbers but in a same sequence like
whenever i run and click on generate button it shows
973
again click
950
again click
939
but when i close my programme and again running programme then same sequence starting from 973
973
again click
950
again click
939
so i want codes for generating random string or integer without repeating sequence after programme closing again and again

thanks
pardeep

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by apegram
0

Add a call to Randomize() before the process that begins the creation of the random numeric string. Example:

Randomize()

        For i As Integer = 0 To 10
            Console.WriteLine(Rnd())
        Next

        Console.Read()

Without Randomize() in the above example, you would get the same 10 values if you ran the program twice. With it, you get the different results you expect.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.