473,807 Members | 2,827 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

alternative to rand()

hello,
Is there any alternative of rand() function i.e i mean any source
avilable to perform same as rand()without using any built in function,
plz reply,
thanks in advance,
bye.
Nov 14 '05 #1
30 4443
On 6 Apr 2004 13:51:06 -0700, sw************@ yahoo.co.in (Sweety)
wrote:
hello,
Is there any alternative of rand() function i.e i mean any source
avilable to perform same as rand()without using any built in function,
plz reply,
thanks in advance,
bye.


Of course there is. Do some reading about random number generators,
pick an algorithm you'd like to try, learn a programming language,
then implement the algorithm.

If you're looking for a ready-made function, try a google search on
"PRNG source" or "random number generator source."

--
Al Balmer
Balmer Consulting
re************* ***********@att .net
Nov 14 '05 #2
On 6 Apr 2004 13:51:06 -0700, sw************@ yahoo.co.in (Sweety)
wrote:
hello,
Is there any alternative of rand() function i.e i mean any source
avilable to perform same as rand()without using any built in function,
plz reply,
thanks in advance,
bye.


Of course there is. Do some reading about random number generators,
pick an algorithm you'd like to try, learn a programming language,
then implement the algorithm.

If you're looking for a ready-made function, try a google search on
"PRNG source" or "random number generator source."

--
Al Balmer
Balmer Consulting
re************* ***********@att .net
Nov 14 '05 #3
Sweety wrote:
hello,
Is there any alternative of rand() function i.e i mean any source
avilable to perform same as rand()without using any built in function,
There are many alternatives. You can use www.google.com to search for
them on the Web, or groups.google.c om to search for both links and code
that have been posted to this newsgroup.
plz reply,
The above line is impolite.
thanks in advance,
The above line is impolite.
bye.


Bye.
Nov 14 '05 #4
Sweety wrote:
hello,
Is there any alternative of rand() function i.e i mean any source
avilable to perform same as rand()without using any built in function,
There are many alternatives. You can use www.google.com to search for
them on the Web, or groups.google.c om to search for both links and code
that have been posted to this newsgroup.
plz reply,
The above line is impolite.
thanks in advance,
The above line is impolite.
bye.


Bye.
Nov 14 '05 #5
Em Tue, 06 Apr 2004 14:01:47 -0700, Alan Balmer escreveu:
On 6 Apr 2004 13:51:06 -0700, sw************@ yahoo.co.in (Sweety)
wrote:
hello,
Is there any alternative of rand() function i.e i mean any source
avilable to perform same as rand()without using any built in function,
plz reply,
thanks in advance,
bye.

<snip>

This should go to the FAQ, if it isn't already there...
--
José de Paula Rodrigues Neto Assis Linux User 175920
Brasília - DF - Brasil counter.li.org

Nov 14 '05 #6
Em Tue, 06 Apr 2004 14:01:47 -0700, Alan Balmer escreveu:
On 6 Apr 2004 13:51:06 -0700, sw************@ yahoo.co.in (Sweety)
wrote:
hello,
Is there any alternative of rand() function i.e i mean any source
avilable to perform same as rand()without using any built in function,
plz reply,
thanks in advance,
bye.

<snip>

This should go to the FAQ, if it isn't already there...
--
José de Paula Rodrigues Neto Assis Linux User 175920
Brasília - DF - Brasil counter.li.org

Nov 14 '05 #7
sw************@ yahoo.co.in (Sweety) writes:
Is there any alternative of rand() function i.e i mean any source
avilable to perform same as rand()without using any built in function,


http://benpfaff.org/writings/clc
Nov 14 '05 #8
sw************@ yahoo.co.in (Sweety) writes:
Is there any alternative of rand() function i.e i mean any source
avilable to perform same as rand()without using any built in function,


http://benpfaff.org/writings/clc
Nov 14 '05 #9
In <c4************ *@ID-227552.news.uni-berlin.de> Martin Ambuhl <ma*****@earthl ink.net> writes:
Sweety wrote:
thanks in advance,


The above line is impolite.


Bullshit. It is such a common courtesy phrase that it even has a
"standard" abbreviation: TIA.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
4228
by: Tom McCallum | last post by:
Can any tell me why rand() is such a bad pseudo-random number generator. In all the articles I have read they say that you can predict the outcome of rand() but when I used its output with NIST's random number testsuite it passed all of the tests thrown at it for randomness. Can anyone suggest a test I could use that it would fail? A pointer to a suitable article would be appreciated. Thanks for your help in advance, Tom
2
5470
by: Kristofer Berggren | last post by:
Hi, I'm developing a simple application which uses rand() frequently, and I was just wondering if there are any alternatives to generating random numbers other than the in-built function in C? I'm using GNU C/C++ compiler 3.3.1. rand() works okay for me, but I suppose it has its limitations? /Kristofer
0
343
by: Sweety | last post by:
hello, Is there any alternative of rand() function i.e i mean any source avilable to perform same as rand()without using any built in function, plz reply, thanks in advance, bye.
36
2696
by: Profetas | last post by:
Hi, I want to generate a random 8 bit number using rand(0 is that possible? to expecifu the base and the lenght? thanks
8
4399
by: Jack | last post by:
When I use rand(), is the RAND_MAX value how long I am guaranteed that the same value will not appear twice? And is this a floating window? For example, if RAND_MAX is 32767, and I make 500,000 consecutive rand calls then is the rand() algorithm going to guarantee me that no floating window of calls over that 500,000 rand calls will have the same value twice? The only way that would work is if the series was identical everytime.
4
2798
by: Siam | last post by:
Hi all, I'm writing a shell language in c++ that supports the generation of random numbers, and by its nature, each command must be executed in a new thread. The call to the random function from my language simply propogates up to the rand( ) function from c++. For some reason, C++ will give each thread independent use of their own rand( ) function, so that a rand( ) call from one thread won't affect another thread's call to rand( )....
5
2326
by: ds | last post by:
Hi all, rand() is not thread safe, a fact that may not be so bad after all.. However, I face the following problem: a piece of code uses rand() to get a random sequence, but always seeds with the same seed for reproducibility of the results. Now I am porting this (old C89) code and have setup a nice app with threads that drives on one thread the old code and on another the new code, so that I can compare the results and see that nothing...
10
3023
by: Rafael Cunha de Almeida | last post by:
Hi, I've found several sites on google telling me that I shouldn't use rand() % range+1 and I should, instead, use something like: lowest+int(range*rand()/(RAND_MAX + 1.0))
15
3950
by: Rich Fife | last post by:
Quick rand() question: I know you're not supposed to use "rand() % 1024" for instance, because it focuses on the lower bits. However, it seems to me that given that the argument is not a power of two (or near a power of two), that this is not an issue. The upper bits will participate equally in the result with the lower. Am I missing something? Thanks!
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10628
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10113
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.