Navigation X
ALERT
Click here to register with a few steps and explore all our cool stuff we have to offer!



 1323

Can someone help me put proxy list into my program?[C#]

by vril - 27 June, 2020 - 10:00 PM
This post is by a banned member (vril) - Unhide
vril  
Infinity
276
Posts
79
Threads
4 Years of service
#1
Hey i made a simple checker. im just learning c#. I now need to put proxies into the program. I just want to learn how to use proxy rotation in a checker. Comment your discord if u wanna help. I will send the code to u on discord. I can pay u if need.
This post is by a banned member (Shiki Fuujin) - Unhide
158
Posts
64
Threads
5 Years of service
#2
(This post was last modified: 27 June, 2020 - 10:51 PM by Shiki Fuujin.)
Code:
 
var lines = File.ReadAllLines("PATH");
var rnd = new Random();
var randomLine = rnd.Next(0, lines.Length - 1);
var line = lines[randomLine];
This post is by a banned member (vril) - Unhide
vril  
Infinity
276
Posts
79
Threads
4 Years of service
#3
(27 June, 2020 - 10:50 PM)Shiki Fuujin Wrote: Show More
Code:
 
var lines = File.ReadAllLines("PATH");
var rnd = new Random();
var randomLine = rnd.Next(0, lines.Length - 1);
var line = lines[randomLine];
Hello sir whats ur discord
This post is by a banned member (Suspect) - Unhide
Suspect  
Registered
75
Posts
2
Threads
4 Years of service
#4
(This post was last modified: 28 June, 2020 - 12:22 AM by Suspect.)
(27 June, 2020 - 11:25 PM)psilocybin Wrote: Show More
(27 June, 2020 - 10:50 PM)Shiki Fuujin Wrote: Show More
Code:
 
var lines = File.ReadAllLines("PATH");
var rnd = new Random();
var randomLine = rnd.Next(0, lines.Length - 1);
var line = lines[randomLine];
Hello sir whats ur discord

It would be much better to use an Indexer rather than Random besides that the Random Class isn't truly Random anyhow. With an Indexer you can follow the list in order, it's generally my go to unless order is completely obsolete then you are better off using a Hashset rather than List or Array as you will get slightly more performance. Although Array has the fastest indexing out of any of the Collections in .NET.

Randomized item from list = Hashset, I would also rather use XOR for getting a random item within a collection it is 10x faster than System.Random Class. XorShift the class is called, it was originally from C++ although I have a translated version to C# which i've edited and it works flawlessly.
Indexer = Array or List, Similar speeds but by benchmarking Array was slightly faster.

 
This post is by a banned member (vril) - Unhide
vril  
Infinity
276
Posts
79
Threads
4 Years of service
#5
(28 June, 2020 - 12:17 AM)Suspect Wrote: Show More
(27 June, 2020 - 11:25 PM)psilocybin Wrote: Show More
(27 June, 2020 - 10:50 PM)Shiki Fuujin Wrote: Show More
Code:
 
var lines = File.ReadAllLines("PATH");
var rnd = new Random();
var randomLine = rnd.Next(0, lines.Length - 1);
var line = lines[randomLine];
Hello sir whats ur discord

It would be much better to use an Indexer rather than Random besides that the Random Class isn't truly Random anyhow. With an Indexer you can follow the list in order, it's generally my go to unless order is completely obsolete then you are better off using a Hashset rather than List or Array as you will get slightly more performance. Although Array has the fastest indexing out of any of the Collections in .NET.

Randomized item from list = Hashset, I would also rather use XOR for getting a random item within a collection it is 10x faster than System.Random Class. XorShift the class is called, it was originally from C++ although I have a translated version to C# which i've edited and it works flawlessly.
Indexer = Array or List, Similar speeds but by benchmarking Array was slightly faster.

How can i use XORShift? is it a nuget package?
This post is by a banned member (Suspect) - Unhide
Suspect  
Registered
75
Posts
2
Threads
4 Years of service
#6
(28 June, 2020 - 04:44 PM)psilocybin Wrote: Show More
(28 June, 2020 - 12:17 AM)Suspect Wrote: Show More
(27 June, 2020 - 11:25 PM)psilocybin Wrote: Show More
Hello sir whats ur discord

It would be much better to use an Indexer rather than Random besides that the Random Class isn't truly Random anyhow. With an Indexer you can follow the list in order, it's generally my go to unless order is completely obsolete then you are better off using a Hashset rather than List or Array as you will get slightly more performance. Although Array has the fastest indexing out of any of the Collections in .NET.

Randomized item from list = Hashset, I would also rather use XOR for getting a random item within a collection it is 10x faster than System.Random Class. XorShift the class is called, it was originally from C++ although I have a translated version to C# which i've edited and it works flawlessly.
Indexer = Array or List, Similar speeds but by benchmarking Array was slightly faster.

How can i use XORShift? is it a nuget package?
Code:
 
static XorShiftRandom XorShift { get; } = new XorShiftRandom();

using System;
using System.Collections.Generic;



namespace Haus.Math
{

    internal class XorShiftRandom
    {

        #region Data Members

        // Constants
        private IEnumerator<uint> r { get; set; }



        public static readonly Dictionary<string, uint> defaults = new Dictionary<string, uint>(){
            {"x",123456789},
            {"y",362436069},
            {"z",521288629},
            {"w",88675123}
        };
        
        public readonly Dictionary<string, uint> seeds;

        public uint randCount = 0;

        public XorShiftRandom(uint? _w = null, uint? _x = null, uint? _y = null, uint? _z = null)
        {
            uint w = _w ?? (uint)Environment.TickCount;
            uint x = _x ?? w << 13;
            uint y = _y ?? (w >> 9) ^ (x << 6);
            uint z = _z ?? y >> 7;
            seeds = new Dictionary<string, uint>(){
                {"x",x},{"y",y},{"z",z},{"w",w}
            };
            r = randGen(w, x, y, z);
        }

        public static IEnumerator<uint> randGen(uint w, uint x, uint y, uint z)
        {
            uint t;
            for (; ; )
            {
                t = x ^ (x << 11);
                x = y;
                y = z;
                z = w;
                yield return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
            }
        }

        public uint rand()
        {
            randCount++;
            r.MoveNext();
            return r.Current;
        }

        public int randInt(int min = 0, int max = 0x7FFFFFFF)
        {
            return (int)(rand() % (max - min + 1)) + min;
        }

        public float randFloat(float min = 0, float max = 1)
        {
            return (float)(rand() % 0xFFFF) / 0xFFFF * (max - min) + min;
        }

        public T[] Shuffle<T>(T[] _arr)
        {
            var arr = (T[])_arr.Clone();
            for (int i = 0; i <= arr.Length - 2; i++)
            {
                int r = randInt(i, arr.Length - 1);
                T tmp = arr[i];
                arr[i] = arr[r];
                arr[r] = tmp;
            }
            return arr;
        }

        public List<T> Shuffle<T>(List<T> _arr)
        {
            var arr = new List<T>(_arr);
            for (int i = 0; i <= arr.Count - 2; i++)
            {
                int r = randInt(i, arr.Count - 1);
                T tmp = arr[i];
                arr[i] = arr[r];
                arr[r] = tmp;
            }
            return arr;
        }

      

        #endregion

    }

}

 
This post is by a banned member (vril) - Unhide
vril  
Infinity
276
Posts
79
Threads
4 Years of service
#7
(29 June, 2020 - 02:33 AM)Suspect Wrote: Show More
(28 June, 2020 - 04:44 PM)psilocybin Wrote: Show More
(28 June, 2020 - 12:17 AM)Suspect Wrote: Show More
It would be much better to use an Indexer rather than Random besides that the Random Class isn't truly Random anyhow. With an Indexer you can follow the list in order, it's generally my go to unless order is completely obsolete then you are better off using a Hashset rather than List or Array as you will get slightly more performance. Although Array has the fastest indexing out of any of the Collections in .NET.

Randomized item from list = Hashset, I would also rather use XOR for getting a random item within a collection it is 10x faster than System.Random Class. XorShift the class is called, it was originally from C++ although I have a translated version to C# which i've edited and it works flawlessly.
Indexer = Array or List, Similar speeds but by benchmarking Array was slightly faster.

How can i use XORShift? is it a nuget package?
Code:
 
static XorShiftRandom XorShift { get; } = new XorShiftRandom();

using System;
using System.Collections.Generic;



namespace Haus.Math
{

internal class XorShiftRandom
{

#region Data Members

// Constants
private IEnumerator<uint> r { get; set; }



public static readonly Dictionary<string, uint> defaults = new Dictionary<string, uint>(){
{"x",123456789},
{"y",362436069},
{"z",521288629},
{"w",88675123}
};

public readonly Dictionary<string, uint> seeds;

public uint randCount = 0;

public XorShiftRandom(uint? _w = null, uint? _x = null, uint? _y = null, uint? _z = null)
{
uint w = _w ?? (uint)Environment.TickCount;
uint x = _x ?? w << 13;
uint y = _y ?? (w >> 9) ^ (x << 6);
uint z = _z ?? y >> 7;
seeds = new Dictionary<string, uint>(){
{"x",x},{"y",y},{"z",z},{"w",w}
};
r = randGen(w, x, y, z);
}

public static IEnumerator<uint> randGen(uint w, uint x, uint y, uint z)
{
uint t;
for (; ; )
{
t = x ^ (x << 11);
x = y;
y = z;
z = w;
yield return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
}
}

public uint rand()
{
randCount++;
r.MoveNext();
return r.Current;
}

public int randInt(int min = 0, int max = 0x7FFFFFFF)
{
return (int)(rand() % (max - min + 1)) + min;
}

public float randFloat(float min = 0, float max = 1)
{
return (float)(rand() % 0xFFFF) / 0xFFFF * (max - min) + min;
}

public T[] Shuffle<T>(T[] _arr)
{
var arr = (T[])_arr.Clone();
for (int i = 0; i <= arr.Length - 2; i++)
{
int r = randInt(i, arr.Length - 1);
T tmp = arr[i];
arr[i] = arr[r];
arr[r] = tmp;
}
return arr;
}

public List<T> Shuffle<T>(List<T> _arr)
{
var arr = new List<T>(_arr);
for (int i = 0; i <= arr.Count - 2; i++)
{
int r = randInt(i, arr.Count - 1);
T tmp = arr[i];
arr[i] = arr[r];
arr[r] = tmp;
}
return arr;
}



#endregion

}

}

Thank you for this. Check PMs
This post is by a banned member (Xaxlii) - Unhide
Xaxlii  
Supreme
126
Posts
55
Threads
4 Years of service
#8
Hi, have you fixed ur issue?
wack

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
or
Sign in
Already have an account? Sign in here.


Forum Jump:


Users browsing this thread: 1 Guest(s)