![]() |
|
[.NET] generate a random number - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] generate a random number (/showthread.php?tid=5574041) |
generate a random number - Sickness - Mar 13, 2017 Well need a easy code but I dont know what to do: I need to generate a random number like this: ![]() What I can put there? 19 numbers * - Visual Freedom - Mar 13, 2017 Just use Random().Next(1000,9999) and use concat to add them into a row of many * - Barret - Mar 13, 2017 PHP Code * - Sn0wX - Mar 13, 2017 ONE instance and one alone now mr barret :) * - BoliBerrys - Mar 13, 2017 Code const string numbers = "0123456789";EDIT: I just realized this is the VB section and not the C#, so my code is useless to you. * - Barret - Mar 13, 2017 (Mar 13, 2017 06:02 PM)BoliBerrys Wrote: you lil fucker replicated my version :P hahahaha 🤣 * - BahNahNah - Mar 13, 2017 Heres how i would do it: Code Dim r As New Random()And heres a short verson for the lols Code Function GetRandomNumberString(len As Integer) As String* - BoliBerrys - Mar 14, 2017 (Mar 13, 2017 07:29 PM)Barret Wrote: you lil fucker replicated my version :P hahahaha 🤣 No idea what u coded haha Sorry if its basically the same ðŸ˜ðŸ˜ * - Barret - Mar 14, 2017 (Mar 14, 2017 06:09 PM)BoliBerrys Wrote: No idea what u coded haha Dont sweat it, nothing is ever owned, everything is copied of something. Heck even nature does that. :P * - Sn0wX - Mar 14, 2017 (Mar 14, 2017 07:25 PM)Barret Wrote: Dont sweat it, nothing is ever owned, everything is copied of something. Heck even nature does that. :P some one "your" level should know NEVER initialize the random class multiple times. * - BahNahNah - Mar 14, 2017 (Mar 14, 2017 07:35 PM)Sn0wX Wrote: some one "your" level should know NEVER initialize the random class multiple times. Its static. There is only one instance. * - Barret - Mar 15, 2017 (Mar 14, 2017 09:18 PM)BahNahNah Wrote: Its static. There is only one instance. Just ignore it, hes just being silly. Just look beyond and be fine. * - Sn0wX - Mar 15, 2017 Urgh child's time. Static cant use different seeds. It's not thread safe. This is basic GOOD CODING STANDARDS. but hey when you guys use so many single instances in your apps i would expect you to carry THEM. oh wait you do not. You wouldn't be able to use different seeds if it were static - the Random instance keeps track of that state. By default Random uses the current time as seed * - BahNahNah - Mar 15, 2017 (Mar 15, 2017 04:47 PM)Sn0wX Wrote: Urgh child's time. What are you talking about? Objects are reference types, the sttaic var just stores the pointer to the random Instance. |