1
Reply

How to set Random No Logic

n panchal

n panchal

Jun 17 2015 2:20 AM
521

Sql Server Question

2000 ltr Water tank needs to be filled up with 1000 entries only . so for this
AS A INPUT : -
Generate 1000 Random Numbers with in a range 0.01 to 3.0 in such a way that total of this number is 2000.0


Now when this 1000 random numbers gets generated ,


AS A OUTPUT :-
Range of OUTPUT is in Between ((INPUT * 70) /100) AND ((INPUT * 80 )/100) in such a way that total of this number is 1500.0
Now when this 1000 random numbers gets generated ,


AS A Gain :-
For Gain i will have to use following formula : Gain = (OUTPUT/INPUT) * 100
And Gain must be in between (70 < Gain < 80) .


SrNo

Input

OutPut

Gain

1

1.50

0.90

70.70

2

1.10

1.45

75.74

--

--

--

--

1000

2.00

1.58

76.52

this table Entry is dummy

CRITERIA :-> In above table TOTAL OF INPUT MUST BE 2000 AND TOTAL OF OUTPUT MUST BE 1500.
-> INPUT MUST BE GREATER THEN OUTPUT AND BOTH INPUT AND OUTPUT MUST BE NON ZERO
-> RESULT MUST BE BETWEEN 70 TO 80
-> TOTAL ENTRY MUST 1000 ONLY
-> AFTER POINT TWO VALUES ARE ALLOWED i.e(1.25432 = 1.25)


Generate a random numbers based on this logic with SQL SERVER query OR ASP.NET C# Code

Please Reply .
 

Answers (1)