Latest Forum Posts
Denying pensioners winter fuel allowance
last post by Jitendar Canth
Arsenal 24/25 season
last post by Snaps
[VIDEO] The Last of Us (HBO)
last post by marksparks999
Scams
last post by Snaps
[VIDEO] Red One
last post by Par Mizan
Top Gear really is back!
last post by admars
Mr Bates vs The Post Office
last post by Par Mizan
[VIDEO] Thunderbolts
last post by RJS
[VIDEO] NCIS Origins
last post by Brooky
Post Trump fallout
last post by Pete-MK
Have I Got News For You
last post by Jitendar Canth
[VIDEO] Living on Youtube
last post by admars
[VIDEO] The Rubber-Keyed Wonder
last post by Jitendar Canth
Blakes 7 coming to Blu-Ray
last post by marksparks999

Page 1 of Random numbers

PCs & Mobiles Forum

Random numbers

stephen harris (Competent) posted this on Monday, 20th March 2006, 21:06

Anybody know where I can down load a Random number generator which will let me specify limits.
I want to generate numbers between 1 and 659 initially, but will need to expand the range upwards later

Thanks in advance

Steve Harris

RE: Random numbers

MikeElliot (Elite) posted this on Monday, 20th March 2006, 21:31

If you download a free GNU C++ compiler, it is very simple to write one - literally a handful of lines of code by including the C++ standard library and using the rand() function. That`s all there is to it!

This item was edited on Monday, 20th March 2006, 21:42

RE: Random numbers

rvshah (Elite) posted this on Monday, 20th March 2006, 21:49

Again in Java is a random class with a method that can do that for you just write a very simple program and your off. If you are really strugguling to do it PM me and I will get a little method do do it for you.

You need to download SDK though.

RE: Random numbers

Jemson (Mostly Harmless) posted this on Monday, 20th March 2006, 22:02

The C route is much easier and quicker, don`t forget to seed the random number generator too as it they are not really random - just algorithms.

RE: Random numbers

MikeElliot (Elite) posted this on Monday, 20th March 2006, 22:25

Yep, that`s why I suggested Gnu C++ compiler as it`s a small download but if Steve already has a compiler then it`s basically take your pick.

I understand about the seeding as there is no such thing as a computed random number.

RE: Random numbers

captain_travers (Harmless) posted this on Tuesday, 21st March 2006, 15:49

This is easily done in Excel with the RAND function and a little bit of logic.

multiply the RAND output by 10000 to get a number between 0 and 10000.

Then an IF statement to give the limits, and a tiny macro to auto calc until the value falls between the limits.

Go back to PCs & Mobiles Forum threads, or All Forum threads