Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

How to: Generate random numbers! [Noob proof]

Hey everything I am going to show you how to generate a random number between 2 numbers chosen by you., but please remember the max you can go up to is.

1 and 2,147,483,647.

First of your going to want to create a button and a text box, name the button whatever you want, I am going to go with "Generate"
It should look like this:

[IMG]http://i45.[censored].com/6xulgh.jpg[/IMG]

Now double click the button or right click and select "view code".
Now, between these 2 texts:
Code
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Code
End Sub

You put this:
Code
Dim r As Integer
Code
Dim objRandom As New System.Random(CType(System.DateTime.Now.Ticks Mod System.Int32.MaxValue, Integer))

This is basically declaring r as an integer and making it so you can use r which will generate a random number. But first, you need to say between what numbers you want E.G 1-100, 10-500, 11-12

So between these:
Code
Dim objRandom As New System.Random(CType(System.DateTime.Now.Ticks Mod System.Int32.MaxValue, Integer))
Code
end sub

put:

Code
r = objRandom.Next(1, 10)
This is saying that your integer equals a random number between 1 and 10, if you want to change the number simply change "(1, 10)" to whatever you want.

That's all good but now the final step is to make it so the random number will appear somewhere, atm it generates a random number but doesn't show it, so in between:
Code
r = objRandom.Next(1, 10)
and
Code
end sub

Put this bit of code:

Code
TextBox1.Text = r
This will make the generated number appear in text box 1.

Now to make it a bit more advanced you could copy the first bit where you "dim r as integer" and "dim objrandom as new..." but this time change these:

"r" and "objrandom" so now you can have
Code
Dim t As Integer
Code
Dim Randoml As New System.Random(CType(System.DateTime.Now.Ticks Mod System.Int32.MaxValue, Integer))

Or whatever you want, after you have done this put the other bit of code as well
Code
r = objRandom.Next(1, 10)
And change "r" and "objrandom" to whatever you delcared (dim) earlier on.

This will enable you to put this instead
Code
TextBox1.Text = t & "x" & r 'Displays the number in a text box

This code will make the integer "t" appear which in my case was a random number between 10 and 99 and then the letter "x" appear and then the integer "r" appear which in my case was a random number between 100 and 1000.
Getting something like this: "54x753"

This project may help in fake programs such as keygens/auth gens etc. So hope you enjoyed my tutorial and hopefully you learned something thanks.
No comments? ):
msgmsgmsgmsg
Thank you, will use it to make a fake keygen and spread it 😉.
(Feb 7, 2010 10:24 AM)collinetnick Wrote:  Thank you, will use it to make a fake keygen and spread it 😉.

Woot first comment :P
(Feb 7, 2010 10:25 AM)Nezami Wrote:  Woot first comment :P

Can you just give me the whole source code instead of telling me to put code in between code?
(Feb 7, 2010 10:28 AM)collinetnick Wrote:  Can you just give me the whole source code instead of telling me to put code in between code?

Yes 1 Second

Code
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim r As Integer
        Dim objRandom As New System.Random(CType(System.DateTime.Now.Ticks Mod System.Int32.MaxValue, Integer))

        Dim t As Integer
        Dim James As New System.Random(CType(System.DateTime.Now.Ticks Mod System.Int32.MaxValue, Integer))

        t = James.Next(10, 99)
        r = objRandom.Next(1000000000, 2000000000) 'Number Between 1000000000 and 2000000000

        TextBox1.Text = t & "x" & r 'Displays the number in a text box
    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    End Sub
End Class
niiice. Now I can do keygens instead of fake hacks for games...Keygen so much more effective
How can we change the code's to enable it to generate number's we listed.
nice tut, noob friendly🤣
can i use this Generate Random Number in my Crypter ?
As the Infinity Crypter etc etc ?
Can i use ?
(Feb 7, 2010 11:29 AM)Leoopardss Wrote:  can i use this Generate Random Number in my Crypter ?
As the Infinity Crypter etc etc ?
Can i use ?

If you mean "do i have permission to use" then yes.
(Feb 7, 2010 11:32 AM)Nezami Wrote:  If you mean "do i have permission to use" then yes.


I think he mean's, can it work. And if you edit the code to the amount of interval's as your crypter need's then yes.
(Feb 7, 2010 11:39 AM)collinetnick Wrote:  I think he mean's, can it work. And if you edit the code to the amount of interval's as your crypter need's then yes.

Oh okay :P Im still a noob at this stuff so I don't know what he means and stuff ;D
Thanks It helped alot :D
(Feb 7, 2010 10:48 AM)collinetnick Wrote:  How can we change the code's to enable it to generate number's we listed.

http://www.youtube.com/user/TeachMeCompu...SGUDpLWp-k


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by Tr0jandogJul 18, 2020 12:05 AM 4 224 Jul 18, 2020 12:05 AM
Last Post: Xora
[C#] by draxyeeDec 28, 2019 03:44 PM 2 294 Dec 28, 2019 03:44 PM
Last Post: Eternal Darkness
[Python] by Smirking_EmojiDec 5, 2019 09:26 PM 13 388 Dec 5, 2019 09:26 PM
Last Post: magicparty