Click here to Skip to main content
15,917,928 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
hi i want to product random number between 0 and 1,how can i do this work
Posted
Comments
Sergey Alexandrovich Kryukov 4-Aug-11 2:27am    
Any requirement for distribution?
--SA

C#
Random rnd = new Random();
double randomNumber = rnd.NextDouble();
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 4-Aug-11 2:26am    
Sure, a 5.
--SA
david_raberty 4-Aug-11 2:41am    
it don't work
it's value is system.random don't product number
RaviRanjanKr 4-Aug-11 9:31am    
Nice Answer, My 5+
It might be helpful,

Random number: 0 or 1 [^]

Please see answer 4 from that site.

:)
 
Share this answer
 
Comments
RaviRanjanKr 4-Aug-11 9:31am    
Good Links, My 5+
Mohammad A Rahman 4-Aug-11 17:29pm    
Thanks Ravi :)
Is this what you were asking for?

C#
Random rnd = new Random();
int minvalue = 10,maxvalue =100;
int product = rnd.Next(minvalue,maxvalue) * rnd.Next(minvalue,maxvalue);
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900