Not Yet Answered # Random numbers...really random??

Narue 5,707 felgall 2 Im trying to bind my custom vertical scrollbar to datagridview is this possible.. Please help Thnak you..

0

>So is the random number genarator really random

No. The random number generator creates pseudorandom numbers that just look good to a point. Depending on the quality of the generator that point will be quick to arive or not.

>The weird thing is I get 4 like 6 out of 10 times each time I run the program.

That sounds fairly normal. A completely random distribution would have each number equally likely to come up. But pseudorandom numbers aren't quite that good and you can expect slightly skewed results. The best solution is to provide as random of a seed as you can, or replace the random number generator with something better.

0

Most of the computerized random number generators that I have seen use the last few digits of the time field (milliseconds?) as the seed. Since the start time is going to be random this starts of the random number generator at a random spot in its sequence.

Computer random number generators usually use a formula to derive one number from the previous and eventually cycle through all possible numbers between zero and a fairly large number (usually tens of thousands) but jumping all over the place within the number range during the process. As you usually only want a small number (say up to 100) returned when these tens of thousands of numbers are scaled down they give the appearance of a random sequence of numbers.

The important thing to remember with random number generators is that if you start with the same seed then you will always get the same "random" sequence. That is why you need to use a random number to seed the generator to start with.

**Isn't it about time forums rewarded their contributors?**

Contribute to this discussion and earn rewards points that can be cashed out for dollars.

This article has been dead for over six months. Start a new discussion instead.

Recommended Articles

I'm trying to figure out how do i print a distinct enum value by using a conditional statement in my construction of array.

I have a enum declaration

`enum Animal {Rat, Ox, Tiger, Rabbit, Dragon, Snake, Horse, Sheep, Monkey, Rooster, Dog, Pig};`

And i construct my array using a voidptr ...

I'm new to python, for my project I need to send mail from python.. I'm getting the following error can someone please help me how to get out of it..

```
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for ...
```