Jump to content

Search the Community

Showing results for tags 'rnd'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Talk
    • Everything Else
    • Gaming
    • Questions
    • Business and Enterprise IT
    • Security
    • Hacks & Mods
    • Applications & Coding
    • Trading Post
  • Hak5 Gear
    • Hak5 Cloud C²
    • WiFi Pineapple Mark VII
    • USB Rubber Ducky
    • Bash Bunny
    • Key Croc
    • Packet Squirrel
    • Shark Jack
    • Signal Owl
    • LAN Turtle
    • Screen Crab
    • Plunder Bug
  • O.MG (Mischief Gadgets)
    • O.MG Cable
    • O.MG DemonSeed EDU
  • WiFi Pineapple (previous generations)
    • WiFi Pineapple TETRA
    • WiFi Pineapple NANO
    • WiFi Pineapple Mark V
    • WiFi Pineapple Mark IV
    • Pineapple Modules
    • WiFi Pineapples Mark I, II, III
  • Hak5 Shows
  • Community
    • Forums and Wiki
    • #Hak5
  • Projects
    • SDR - Software Defined Radio
    • Community Projects
    • Interceptor
    • USB Hacks
    • USB Multipass
    • Pandora Timeshifting

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Enter a five letter word.

Found 1 result

  1. So I was thinking about ways to create random directories and file names. I figure first I'll have to create a random string function first. I'm sure there are a ton of ways to do this. So here I'll just post what I came up with. I was messing around with Visual BASIC today. So that's what I coded it in. Any example are great. Don't care what language they are in. I created a string array and just used random numbers to index the array elements, then I concatenated them together to make a single string variable. I was going to make a random string of a random length by creating a random number and using that to end my loop but VB didn't like the syntax I was using. Module Module1 Sub Main() Dim StringArray() As String = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"} Dim RandomInteger As Integer Dim String1 As String Randomize() RandomInteger = Int(Rnd() * 51) String1 = StringArray(RandomInteger) Dim String2 As String Randomize() RandomInteger = Int(Rnd() * 51) String2 = StringArray(RandomInteger) Dim String3 As String Randomize() RandomInteger = Int(Rnd() * 51) String3 = StringArray(RandomInteger) Dim String4 As String Randomize() RandomInteger = Int(Rnd() * 51) String4 = StringArray(RandomInteger) Dim String5 As String Randomize() RandomInteger = Int(Rnd() * 51) String5 = StringArray(RandomInteger) Dim String6 As String Randomize() RandomInteger = Int(Rnd() * 51) String6 = StringArray(RandomInteger) Dim String7 As String Randomize() RandomInteger = Int(Rnd() * 51) String7 = StringArray(RandomInteger) Dim String8 As String Randomize() RandomInteger = Int(Rnd() * 51) String8 = StringArray(RandomInteger) Dim String9 As String Randomize() RandomInteger = Int(Rnd() * 51) String9 = StringArray(RandomInteger) Dim String10 As String Randomize() RandomInteger = Int(Rnd() * 51) String10 = StringArray(RandomInteger) Dim String11 As String Randomize() RandomInteger = Int(Rnd() * 51) String11 = StringArray(RandomInteger) Dim String12 As String Randomize() RandomInteger = Int(Rnd() * 51) String12 = StringArray(RandomInteger) Dim String13 As String Randomize() RandomInteger = Int(Rnd() * 51) String13 = StringArray(RandomInteger) Dim String14 As String Randomize() RandomInteger = Int(Rnd() * 51) String14 = StringArray(RandomInteger) Dim String15 As String Randomize() RandomInteger = Int(Rnd() * 51) String15 = StringArray(RandomInteger) Dim String16 As String Randomize() RandomInteger = Int(Rnd() * 51) String16 = StringArray(RandomInteger) Dim String17 As String Randomize() RandomInteger = Int(Rnd() * 51) String17 = StringArray(RandomInteger) Dim Str1 As String = String1 & String2 & String3 & String4 & String5 & String6 & String7 & String8 & String9 & String10 & String11 & String12 & String13 & String14 & String15 & String16 & String17 Console.WriteLine(Str1) End Sub End Module So I wrote basically the same function in C++. #include <iostream> #include <time.h> #include <stdlib.h> #include <stdio.h> #include <string> #include <sstream> using namespace std; string a; string b; string c; string d; string e; string f; string g; string h; string i; string j; string k; string l; string m; string n; string o; string p; string q; int RandomNumber1; int RandomNumber2; int RandomNumber3; int RandomNumber4; int RandomNumber5; int RandomNumber6; int RandomNumber7; int RandomNumber8; int RandomNumber9; int RandomNumber10; int RandomNumber11; int RandomNumber12; int RandomNumber13; int RandomNumber14; int RandomNumber15; int RandomNumber16; int RandomNumber17; string AlphaRandom[] = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}; int main() { srand(time(0)); RandomNumber1 = rand() % 51 + 0; string a = AlphaRandom[RandomNumber1]; RandomNumber2 = rand() % 51 + 0; string b = AlphaRandom[RandomNumber2]; RandomNumber3= rand() % 51 + 0; string c = AlphaRandom[RandomNumber3]; RandomNumber4= rand() % 51 + 0; string d = AlphaRandom[RandomNumber4]; RandomNumber5= rand() % 51 + 0; string e = AlphaRandom[RandomNumber5]; RandomNumber6= rand() % 51 + 0; string f = AlphaRandom[RandomNumber6]; RandomNumber7= rand() % 51 + 0; string g = AlphaRandom[RandomNumber7]; RandomNumber8= rand() % 51 + 0; string h = AlphaRandom[RandomNumber8]; RandomNumber9= rand() % 51 + 0; string i = AlphaRandom[RandomNumber9]; RandomNumber10= rand() % 51 + 0; string j = AlphaRandom[RandomNumber10]; RandomNumber11= rand() % 51 + 0; string k = AlphaRandom[RandomNumber11]; RandomNumber12= rand() % 51 + 0; string l = AlphaRandom[RandomNumber12]; RandomNumber13= rand() % 51 + 0; string m = AlphaRandom[RandomNumber13]; RandomNumber14= rand() % 51 + 0; string n = AlphaRandom[RandomNumber14]; RandomNumber15= rand() % 51 + 0; string o = AlphaRandom[RandomNumber15]; RandomNumber16= rand() % 51 + 0; string p = AlphaRandom[RandomNumber16]; RandomNumber17= rand() % 51 + 0; string q = AlphaRandom[RandomNumber17]; std::string s = static_cast<std::ostringstream&>(std::ostringstream().seekp(0) << a << b << c << d << e << f << g << h << i << j << k << l << m << n << o << p << q).str(); cout << s; return 0; }
×
×
  • Create New...