----------------------------------- DJ Thu Aug 07, 2003 3:35 pm random real numbers ----------------------------------- i wanna make random real numbers between a certain range. i wanna make these real numbers prices, so ineed a decimal cutoff how? ----------------------------------- poly Thu Aug 07, 2003 5:27 pm ----------------------------------- ooops what I posted here was for integers, sorry! ----------------------------------- AsianSensation Thu Aug 07, 2003 7:04 pm ----------------------------------- Rand.Real it generates a real number between 0 and 1 then just multiply it by a multiplier if you want bigger numbers to be generated for example, you want a real number between 0 and 100 num:=Rand.Real * 100 ----------------------------------- DJ Thu Aug 07, 2003 9:54 pm ----------------------------------- but if i want a random real number between 1 and 100 and with 2 decimal places? i dunno how to use the round function, the help thing dont help ----------------------------------- kmd-10 Thu Aug 07, 2003 10:00 pm ----------------------------------- ok .. use Rand.Real, giving you a number between 0 and 1. then use a multiplier. then multiply it by 100. then use round(n). then divide by 100, and throw in your dollar sign. var num : real var int_num : int var multiplier : int := 100 % now it's a number from 0 to 100. num := Rand.Real * multiplier * 100 int_num := round(num) num := int_num / 100 you could shorten this, but it's to show you what i mean. var multiplier : int := 10000 var num : real := (round(Rand.Real * multiplier)) / 100 and then after that, you'd need to do your check to add necessary zeroes. but that shouldn't be a problem. ----------------------------------- DJ Sun Aug 10, 2003 10:03 pm ----------------------------------- wow and then some that was a good answer ----------------------------------- Namis Thu Sep 11, 2003 3:06 pm Rand.Real ----------------------------------- Couldnt you just use randint(X,X) ??? ----------------------------------- krishon Thu Sep 11, 2003 4:25 pm ----------------------------------- i think that's just for integers.... ----------------------------------- Tony Thu Sep 11, 2003 4:44 pm ----------------------------------- it is... Rand.Int() actually uses Rand.Real() function inside itself to come up with an int.