如何创建随机数 [英] how to genreate random number

查看:90
本文介绍了如何创建随机数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Gridview记录如下



Companyid公司名

选择1 SK

选择2 MR



当我点击gridview中的第一行选择按钮时,显示如下记录

Companyid 1(textbox1)

companyname SK(textbox2)



当我点击gridview中的第二行选择按钮时,显示如下记录

Companyid 2(textbox1)

companyname MR(textbox2)



我想在textbox2中的companyname中显示随机数。

在textbox2我希望输出如下SK34535

simliarily为textbox2中的第二家公司我希望输出如下MK43532。



for that怎么样我在asp.net中使用c#。

In Gridview record as follows

Companyid Companyname
select 1 SK
select 2 MR

When i click the first row select button in gridview display the record as follows
Companyid 1 (textbox1)
companyname SK (textbox2)

simliarily when i click the second row select button in gridview display the record as follows
Companyid 2 (textbox1)
companyname MR (textbox2)

I want to display random number in companyname in textbox2.
In the textbox2 i want output as follows SK34535
simliarily for the 2nd company in the textbox2 i want output as follows MK43532.

for that how can i do in asp.net using c#.

推荐答案

我会阅读文档:Random.Next Method(Int32,Int32)[< a href =https://msdn.microsoft.com/en-us/library/2dx6wyd4(v=vs.110).aspx\"target =_ blanktitle =New Window> ^ ]。


在c#中有很多algos生成随机数。在Google或Bing中搜索并查看哪一个最符合您的要求。



实施。如果您在执行此操作时遇到任何特定问题,请访问此处并提出另一个问题,说明有关您的代码的所有详细信息。
There are many algos to generate random numbers in c#. Search in google or Bing and see which one best suits your requirements.

Implement that. If you face any specific issue while doing that, come here and ask another question describing all the details about your code.


这篇关于如何创建随机数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆