Click here to Skip to main content
15,917,862 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need to random number in hex base - like: 0xA7A77CBD
How can I do it?
Thanks.
Posted

1 solution

C#
var r = new Random();
 int A = r.Next(1000, 5000);
 string hexValue1 = A.ToString("X");
 
Share this answer
 
Comments
CPallini 31-Oct-13 4:17am    
My 5. However, why do you pick a number in the 1000-5000 range?
samit kaneriya 31-Oct-13 5:15am    
you can set any number of Range r.Next(1000, 5000); here random number generate between 1000 to 5000

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