Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate Random Number in .NET without using any Inbuilt Functions

I was wondering how the Random functions in every programming language works so I want to generate a number by myself i.e. I don't want to use any inbuilt classes or functions.

like image 580
Elmo Avatar asked Jan 17 '26 20:01

Elmo


1 Answers

For simplicity and speed, it's hard to beat the Xorshift random number generator. Whether it generates a good distribution is another question.

One example in C#: http://www.codeproject.com/KB/cs/fastrandom.aspx

Different languages and environments use different random number generators. As others have pointed out, there are lots of ways to generate pseudo-random numbers.

See C# Normal Random Number and other similar Stack Overflow questions.

like image 191
Jim Mischel Avatar answered Jan 20 '26 12:01

Jim Mischel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!