Languages
[Edit]
EN

C# / .NET - generate array of random bytes

4 points
Created by:
Kate_C
2854

Random.NextBytes method example

Random random = new Random();

byte[] bytes = new byte[10];
random.NextBytes(bytes);
			
foreach(byte entry in bytes)
	Console.WriteLine(entry);

Output:

100
206
3
229
45
247
73
187
44
237

References

  1. Random Class - Microsoft Docs
Hey 👋
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.