This post is by a banned member (vril) - Unhide
OP 27 June, 2020 - 10:00 PM
Reply
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
27 June, 2020 - 10:50 PM
(This post was last modified: 27 June, 2020 - 10:51 PM by Shiki Fuujin.)
Reply
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
OP 27 June, 2020 - 11:25 PM
Reply
(27 June, 2020 - 10:50 PM)Shiki Fuujin Wrote: Show MoreCode:
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
28 June, 2020 - 12:17 AM
(This post was last modified: 28 June, 2020 - 12:22 AM by Suspect.)
Reply
(27 June, 2020 - 11:25 PM)psilocybin Wrote: Show More (27 June, 2020 - 10:50 PM)Shiki Fuujin Wrote: Show MoreCode:
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
OP 28 June, 2020 - 04:44 PM
Reply
(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 MoreCode:
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
29 June, 2020 - 02:33 AM
Reply
(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 MoreHello 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
OP 29 June, 2020 - 04:58 AM
Reply
(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 MoreIt 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
29 June, 2020 - 01:33 PM
Reply
Hi, have you fixed ur issue?
|