当前位置:网站首页>Random numbers in a long range, is that right- Random number in long range, is this the way?
Random numbers in a long range, is that right- Random number in long range, is this the way?
2022-07-03 19:02:00 【Zafo】
problem :
Can somebody verify this method. Someone can verify this method .I need a long type number inside a range of two longs. I need to be in two long Within the scope of long Type number .I use the .NET Random.Next(min, max) function which return int's. I use return int Of .NET Random.Next(min, max) function .Is my reasoning correct if I simply divide the long by 2, generate the random number and finally multiply it by 2 again? If I simply long Divide 2, Generate random number , Finally, multiply by 2, Is my reasoning correct ?Or am I too enthusiastic... I understand that my random resolution will decrease but are there any other mistakes which will lead to no such a random number. Or am I too enthusiastic …… I know my random resolution will decrease , But is there any other error that will lead to the absence of such random numbers .
long min = st.MinimumTime.Ticks; //long is Signed 64-bit integerlong max = st.MaximumTime.Ticks;int minInt = (int) (min / 2); //int is Signed 64-bit integerint maxInt = (int) (max / 2); //int is Signed 64-bit integerRandom random = new Random();int randomInt = random.Next(minInt, maxInt);long randomLong = (randomInt * 2);Solution :
Reference resources : https://stackoom.com/en/question/RuN8边栏推荐
- Real time split network (continuous update)
- Streaming media server (16) -- figure out the difference between live broadcast and on-demand
- NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
- 我眼中真正优秀的CTO长啥样
- Raft log replication
- CV in transformer learning notes (continuously updated)
- Know what it is, and know why, JS object creation and inheritance [summary and sorting]
- Day-27 database
- 【水质预测】基于matlab模糊神经网络水质预测【含Matlab源码 1923期】
- cipher
猜你喜欢

Record: MySQL changes the time zone

In addition to the prickles that pierce your skin, there are poems and distant places that originally haunt you in plain life

leetcode:11. 盛最多水的容器【双指针 + 贪心 + 去除最短板】

EGO Planner代码解析bspline_optimizer部分(3)

Implementation of cqrs architecture mode under Kratos microservice framework

Pytorch introduction to deep learning practice notes 13- advanced chapter of cyclic neural network - Classification

Zhengda futures news: soaring oil prices may continue to push up global inflation

Integrated easy to pay secondary domain name distribution system
![[optics] dielectric constant calculation based on MATLAB [including Matlab source code 1926]](/img/cb/ee696d5a7d6bef96fe0db89e8478ed.jpg)
[optics] dielectric constant calculation based on MATLAB [including Matlab source code 1926]

Record: solve the problem that MySQL is not an internal or external command environment variable
随机推荐
【学术相关】顶级论文创新点怎么找?中国高校首次获CVPR最佳学生论文奖有感...
利用可视化结果,点击出现对应的句子
我眼中真正优秀的CTO长啥样
记录在模拟器中运行flutter时报的错
Briefly describe the quantitative analysis system of services
After nohup NPM start &, close the shell window directly, and the process closes accordingly
Understanding of database architecture
SSM integration - joint debugging of front and rear protocols (list function, add function, add function status processing, modify function, delete function)
Su embedded training - Day10
Scrape crawler framework
235. 二叉搜索树的最近公共祖先【lca模板 + 找路径相同】
What does foo mean in programming?
The online customer service system developed by PHP is fully open source without encryption, and supports wechat customer service docking
12、 Service management
Analyse du Code du planificateur ego bspline Section Optimizer (1)
my. INI file not found
Flask generates swagger documents
There are several levels of personal income tax
235. Ancêtre public le plus proche de l'arbre de recherche binaire [modèle LCA + même chemin de recherche]
Record the errors reported when running fluent in the simulator